Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor (options) {
super();
const self = this;
self.uri = typeof options.uri === 'string'
? new URL(options.uri) : options.uri;
// Use options.headers instead of `this.headers` if serializing
self.headers = caseless(options.headers);
// Cloudscraper will only call `request.callback` for the very last request
self.callback = options.callback;
// The actual request should be performed at this point.
// Pseudo error event
const error = null;
if (error) {
self.emit('error', new Error('Request error'));
}
// Pseudo response arguments
const body = Buffer.from('Response content', 'utf-8');
const status = 200;
const headers = {
// Response headers
constructor(props, isResolved) {
this.statusCode = props.statusCode || 200;
this.headers = caseless(props.headers || {});
this.body = props.body || null; // null === empty body
this._isResolved = !!isResolved;
}
constructor (headers, statusCode, body) {
this.headers = headers;
this.caseless = caseless(headers);
this.statusCode = statusCode;
this.body = body;
}
}