Skip to content
This repository has been archived by the owner on Nov 21, 2019. It is now read-only.

Commit

Permalink
fix: parse request body using JSON.parse (#9)
Browse files Browse the repository at this point in the history
* fix: parse request body using JSON.parse

* test: parse request body using JSON.parse
  • Loading branch information
Burak Tasci authored Sep 30, 2017
1 parent 93483ad commit 9a3f407
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions src/some-function/some-function.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ describe('@azure-seed/azure-functions-typescript', () => {
method: HttpMethod.Post,
params: {},
query: {},
body: TEST_REQUEST_BODY
body: JSON.stringify(TEST_REQUEST_BODY)
};

run(mockContext, mockRequest);
Expand Down Expand Up @@ -98,7 +98,7 @@ describe('@azure-seed/azure-functions-typescript', () => {
id: TEST_ID
},
query: {},
body: TEST_REQUEST_BODY
body: JSON.stringify(TEST_REQUEST_BODY)
};

run(mockContext, mockRequest);
Expand All @@ -123,7 +123,7 @@ describe('@azure-seed/azure-functions-typescript', () => {
id: TEST_ID
},
query: {},
body: TEST_REQUEST_BODY
body: JSON.stringify(TEST_REQUEST_BODY)
};

run(mockContext, mockRequest);
Expand Down
4 changes: 2 additions & 2 deletions src/some-function/some-function.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ const insertOne = (req: HttpRequest) => {
body: {
id: TEST_ID,
object: OBJECT_NAME,
...req.body
...JSON.parse(req.body || '{}')
}
};
};
Expand All @@ -61,7 +61,7 @@ const updateOne = (req: HttpRequest, id: any) => {
body: {
id,
object: OBJECT_NAME,
...req.body
...JSON.parse(req.body || '{}')
}
};
};
Expand Down

0 comments on commit 9a3f407

Please sign in to comment.