diff --git a/test/main.ts b/test/main.ts index 3218c8b..99a55ea 100644 --- a/test/main.ts +++ b/test/main.ts @@ -41,15 +41,16 @@ const getBook = (ctx: RouterContext) => { const postBook = async (ctx: RouterContext) => { const { request, response } = ctx; + response.type = 'application/json' if (request.hasBody) { const result: any = await request.body({ contentTypes: { text: ["application/javascript"], }, - }); - const body: any = JSON.parse(result.value) + }) + const body: {id:string} = await result.value const book: IBook | undefined = searchBookById(body.id) - if (!book) { + if (!book) { response.status = 200 response.body = body } else { diff --git a/test/test.json b/test/test.json index 3cb1611..0751fc2 100644 --- a/test/test.json +++ b/test/test.json @@ -27,6 +27,6 @@ }, "url": "api-test:3000", "header": { - "Content-Type": "application/javascript" + "Content-Type": "application/json" } }