Skip to content

Commit c3793e3

Browse files
committed
bugfix/added the Content-Type for create and post endpoint
1 parent 3b13d0a commit c3793e3

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/obp/index.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ export async function get(path: string): Promise<any> {
5252

5353
export async function create(path: string, body: any): Promise<any> {
5454
try {
55-
return (await superagent.post(`/api/create?path=${path}`).send(JSON.parse(body))).body
55+
return (await superagent.post(`/api/create?path=${path}`)
56+
.set('Content-Type', 'application/json')
57+
.send(JSON.parse(body)))
58+
.body
5659
} catch (error) {
5760
console.log(error)
5861
return { error }
@@ -61,7 +64,9 @@ export async function create(path: string, body: any): Promise<any> {
6164

6265
export async function update(path: string, body: any): Promise<any> {
6366
try {
64-
return (await superagent.put(`/api/update?path=${path}`).send(JSON.parse(body))).body
67+
return (await superagent.put(`/api/update?path=${path}`)
68+
.set('Content-Type', 'application/json')
69+
.send(JSON.parse(body))).body
6570
} catch (error) {
6671
console.log(error)
6772
return { error }

0 commit comments

Comments
 (0)