mirror of
https://github.com/status-im/status-go.git
synced 2025-01-11 07:07:24 +00:00
b50c46caa8
* Commit initial change for settimeout/setinterval * Add initial tests for jail setTimeout/setInterval * Add ottoext dependency * Add fetch jail test with function * Add dependencies of fetch from ottoext * Refactor with regards to PR review * Refactor with regards to PR review * Fix syntax errors * Fix missing return statement
35 lines
706 B
JavaScript
35 lines
706 B
JavaScript
const Headers = require('./headers');
|
|
|
|
export default class Request {
|
|
constructor(input, {method, headers, redirect, body}={}) {
|
|
this.method = 'GET';
|
|
this.headers = new Headers({});
|
|
this.redirect = 'manual';
|
|
this.body = null;
|
|
|
|
if (input instanceof Request) {
|
|
this.url = input.url;
|
|
this.method = input.method;
|
|
this.headers = new Headers(input.headers);
|
|
this.redirect = input.redirect;
|
|
} else {
|
|
this.url = input;
|
|
}
|
|
|
|
if (method) {
|
|
this.method = method;
|
|
}
|
|
|
|
if (headers) {
|
|
this.headers = new Headers(headers);
|
|
}
|
|
|
|
if (redirect) {
|
|
this.redirect = redirect;
|
|
}
|
|
|
|
if (body) {
|
|
this.body = body;
|
|
}
|
|
}
|
|
} |