Skip to content
This repository was archived by the owner on Oct 24, 2025. It is now read-only.

Commit 434e937

Browse files
committed
Minor fix
1 parent dbaece5 commit 434e937

File tree

4 files changed

+12
-9
lines changed

4 files changed

+12
-9
lines changed

src/call.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,10 @@ async function call(...args) {
4343

4444
let response;
4545
try {
46-
response = await got.post(this.fullAddress_('/cbm/call/'), { body: params, json: true, headers: { returnCode } });
46+
response = await got.post(this.fullAddress_('/cbm/call/'), {
47+
body: params,
48+
json: true,
49+
headers: { returnCode, accept: null } });
4750
} catch (error) {
4851
({ response } = error);
4952
}

src/create.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ async function createConcept(params, host) {
1515
desc: params.desc,
1616
units: [].concat(params.units).map(el => getURI(el)),
1717
},
18-
json: true,
18+
form: true,
1919
});
2020
return res.statusCode === 200;
2121
} catch (error) {
@@ -38,7 +38,7 @@ async function createFunction(params, host) {
3838
returnsNames: [].concat(params.returnsNames).map(el => getURI(el)),
3939
returnsUnits: [].concat(params.returnsUnits).map(el => getURI(el)),
4040
},
41-
json: true,
41+
form: true,
4242
});
4343
return res.statusCode === 200;
4444
} catch (error) {
@@ -72,7 +72,7 @@ async function createAsyncFunction(params, callPath, host) {
7272

7373
try {
7474
const res = await got.post(path, { body: form });
75-
await got.post(callPath, { body: { command: 'fixit' }, json: true });
75+
await got.post(callPath, { body: { command: 'fixit' }, form: true });
7676
return res.statusCode === 200;
7777
} catch (error) {
7878
return false;
@@ -93,7 +93,7 @@ async function createRelation(params, host) {
9393
end: getURI(params.end),
9494
mathRelation: params.mathRelation,
9595
},
96-
json: true,
96+
form: true,
9797
});
9898
return res.statusCode === 200;
9999
} catch (error) {
@@ -137,7 +137,7 @@ async function create(...args) {
137137
created = createRelation(params, this.host);
138138
}
139139
try {
140-
await got.post(path, { body: { command: 'fixit' }, json: true });
140+
await got.post(path, { body: { command: 'fixit' }, form: true });
141141
} catch (error) { /**/ }
142142
return created;
143143
}

src/search.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ async function search(...args) {
2323
}
2424
let response;
2525
try {
26-
response = await got.post(this.fullAddress_('/gbm/search/'), { body: params, json: true });
26+
response = await got.post(this.fullAddress_('/gbm/search/'), { body: params, json: true, headers: { accept: null } });
2727
} catch (error) {
2828
({ response } = error);
2929
}

tests/create.test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ const HOST = process.env.HOST || 'https://call-by-meaning.herokuapp.com';
99
test.after.always(async () => {
1010
const cbm = new CallByMeaning(HOST);
1111
const path = cbm.host.concat('/new/fix');
12-
await got.post(path, { body: { command: 'fixtests' }, json: true });
13-
await got.post(path, { body: { command: 'fixit' }, json: true });
12+
await got.post(path, { body: { command: 'fixtests' }, form: true });
13+
await got.post(path, { body: { command: 'fixit' }, form: true });
1414
});
1515

1616
test('throws an error if not supplied at least one argument', async (t) => {

0 commit comments

Comments
 (0)