mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-07 16:44:27 +01:00
fix: fixed gql related issues
This commit is contained in:
parent
f69332d9c3
commit
1110a4edda
@ -72,7 +72,7 @@ const bruToJson = (bru) => {
|
||||
}
|
||||
};
|
||||
|
||||
transformedJson.request.body.mode = _.get(json, "http.mode", "none");
|
||||
transformedJson.request.body.mode = _.get(json, "http.body", "none");
|
||||
|
||||
return transformedJson;
|
||||
} catch (e) {
|
||||
|
@ -1,46 +1,50 @@
|
||||
class BrunoRequest {
|
||||
constructor(request) {
|
||||
this._request = request;
|
||||
constructor(req) {
|
||||
this.req = req;
|
||||
this.url = req.url;
|
||||
this.method = req.method;
|
||||
this.headers = req.headers;
|
||||
this.body = req.data;
|
||||
}
|
||||
|
||||
getUrl() {
|
||||
return this._request.url;
|
||||
return this.req.url;
|
||||
}
|
||||
|
||||
setUrl(url) {
|
||||
this._request.url = url;
|
||||
this.req.url = url;
|
||||
}
|
||||
|
||||
getMethod() {
|
||||
return this._request.method;
|
||||
return this.req.method;
|
||||
}
|
||||
|
||||
setMethod(method) {
|
||||
this._request.method = method;
|
||||
this.req.method = method;
|
||||
}
|
||||
|
||||
getHeaders() {
|
||||
return this._request.headers;
|
||||
return this.req.headers;
|
||||
}
|
||||
|
||||
setHeaders(headers) {
|
||||
this._request.headers = headers;
|
||||
this.req.headers = headers;
|
||||
}
|
||||
|
||||
getHeader(name) {
|
||||
return this._request.headers[name];
|
||||
return this.req.headers[name];
|
||||
}
|
||||
|
||||
setHeader(name, value) {
|
||||
this._request.headers[name] = value;
|
||||
this.req.headers[name] = value;
|
||||
}
|
||||
|
||||
getBody() {
|
||||
return this._request.data;
|
||||
return this.req.data;
|
||||
}
|
||||
|
||||
setBody(data) {
|
||||
this._request.data = data;
|
||||
this.req.data = data;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,26 +1,26 @@
|
||||
class BrunoResponse {
|
||||
constructor(response) {
|
||||
this._response = response;
|
||||
this.status = response.status;
|
||||
this.statusText = response.statusText;
|
||||
this.headers = response.headers;
|
||||
this.body = response.data;
|
||||
constructor(res) {
|
||||
this.res = res;
|
||||
this.status = res.status;
|
||||
this.statusText = res.statusText;
|
||||
this.headers = res.headers;
|
||||
this.body = res.data;
|
||||
}
|
||||
|
||||
getStatus() {
|
||||
return this._response.status;
|
||||
return this.res.status;
|
||||
}
|
||||
|
||||
getHeader(name) {
|
||||
return this._response.header[name];
|
||||
return this.res.header[name];
|
||||
}
|
||||
|
||||
getHeaders() {
|
||||
return this._response.headers;
|
||||
return this.res.headers;
|
||||
}
|
||||
|
||||
getBody() {
|
||||
return this._response.data;
|
||||
return this.res.data;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,12 +18,12 @@ class ScriptRuntime {
|
||||
}
|
||||
|
||||
runRequestScript(script, request, environment, collectionVariables, collectionPath) {
|
||||
const $bru = new Bru(environment, collectionVariables);
|
||||
const $req = new BrunoRequest(request);
|
||||
const bru = new Bru(environment, collectionVariables);
|
||||
const req = new BrunoRequest(request);
|
||||
|
||||
const context = {
|
||||
$bru,
|
||||
$req
|
||||
bru,
|
||||
req
|
||||
};
|
||||
const vm = new NodeVM({
|
||||
sandbox: context,
|
||||
@ -53,12 +53,12 @@ class ScriptRuntime {
|
||||
}
|
||||
|
||||
runResponseScript(script, response, environment, collectionVariables, collectionPath) {
|
||||
const $bru = new Bru(environment, collectionVariables);
|
||||
const $res = new BrunoResponse(response);
|
||||
const bru = new Bru(environment, collectionVariables);
|
||||
const res = new BrunoResponse(response);
|
||||
|
||||
const context = {
|
||||
$bru,
|
||||
$res
|
||||
bru,
|
||||
res
|
||||
};
|
||||
const vm = new NodeVM({
|
||||
sandbox: context,
|
||||
|
@ -21,18 +21,18 @@ class TestRuntime {
|
||||
}
|
||||
|
||||
runTests(testsFile, request, response, environment, collectionVariables, collectionPath) {
|
||||
const $bru = new Bru(environment, collectionVariables);
|
||||
const $req = new BrunoRequest(request);
|
||||
const $res = new BrunoResponse(response);
|
||||
const bru = new Bru(environment, collectionVariables);
|
||||
const req = new BrunoRequest(request);
|
||||
const res = new BrunoResponse(response);
|
||||
|
||||
const __brunoTestResults = new TestResults();
|
||||
const test = Test(__brunoTestResults, chai);
|
||||
|
||||
const context = {
|
||||
test,
|
||||
$bru,
|
||||
$req,
|
||||
$res,
|
||||
bru,
|
||||
req,
|
||||
res,
|
||||
expect: chai.expect,
|
||||
assert: chai.assert,
|
||||
__brunoTestResults: __brunoTestResults
|
||||
|
@ -42,9 +42,9 @@ const jsonToBru = (json) => {
|
||||
bru += `${http.method} {
|
||||
url: ${http.url}`;
|
||||
|
||||
if(http.body && http.body.length) {
|
||||
if(http.mode && http.mode.length) {
|
||||
bru += `
|
||||
body: ${http.body}`;
|
||||
body: ${http.mode}`;
|
||||
}
|
||||
|
||||
bru += `
|
||||
|
Loading…
Reference in New Issue
Block a user