Skip to content

How to specify request input when testing? #755

Answered by RobinTail
SamuelPires1999 asked this question in Q&A
Discussion options

You must be logged in to vote

Hello @SamuelPires1999 ,

sorry for the unclarity.
For testing your endpoints use the exposed method testEndpoint() having jest and @types/jest installed.
By "parsed JSON" in the body prop of that method I implied that the request body should be an object instead of a string.

The real IO workflow receives the request body as a string and uses body-parser to process it: in particular case — the JSON parser.
However, in testing workflow this step is skipped, so you should supply body the way it would be after parsing the JSON string — as object.
Anyway, it's easier for the development as well.

Nevermind i Just noticed that I've forgot the method property on my test, sorry hahaha

Yeah, the …

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by RobinTail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants