Skip to content

Commit

Permalink
Update test according to oak changes in deno
Browse files Browse the repository at this point in the history
  • Loading branch information
subeshb1 committed Aug 31, 2020
1 parent ec3ddb9 commit bd31aa1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions test/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,16 @@ const getBook = (ctx: RouterContext<any>) => {

const postBook = async (ctx: RouterContext<RouteParams>) => {
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 {
Expand Down
2 changes: 1 addition & 1 deletion test/test.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@
},
"url": "api-test:3000",
"header": {
"Content-Type": "application/javascript"
"Content-Type": "application/json"
}
}

0 comments on commit bd31aa1

Please sign in to comment.