Merge pull request #93 from hongwei1/develop

bugfix/added the Content-Type for create and post endpoint
This commit is contained in:
Simon Redfern 2025-02-27 11:07:36 +01:00 committed by GitHub
commit 0f7c12d463
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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 }