mirror of
https://github.com/OpenBankProject/API-Explorer-II.git
synced 2026-02-06 10:47:04 +00:00
Merge pull request #93 from hongwei1/develop
bugfix/added the Content-Type for create and post endpoint
This commit is contained in:
commit
0f7c12d463
@ -52,7 +52,10 @@ export async function get(path: string): Promise<any> {
|
||||
|
||||
export async function create(path: string, body: any): Promise<any> {
|
||||
try {
|
||||
return (await superagent.post(`/api/create?path=${path}`).send(JSON.parse(body))).body
|
||||
return (await superagent.post(`/api/create?path=${path}`)
|
||||
.set('Content-Type', 'application/json')
|
||||
.send(JSON.parse(body)))
|
||||
.body
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
return { error }
|
||||
@ -61,7 +64,9 @@ export async function create(path: string, body: any): Promise<any> {
|
||||
|
||||
export async function update(path: string, body: any): Promise<any> {
|
||||
try {
|
||||
return (await superagent.put(`/api/update?path=${path}`).send(JSON.parse(body))).body
|
||||
return (await superagent.put(`/api/update?path=${path}`)
|
||||
.set('Content-Type', 'application/json')
|
||||
.send(JSON.parse(body))).body
|
||||
} catch (error) {
|
||||
console.log(error)
|
||||
return { error }
|
||||
|
||||
Loading…
Reference in New Issue
Block a user