Open STommydx opened 4 years ago
JSON uses backslash espaces. So this is the correct behavior. https://www.json.org/json-en.html
@comp4111ta There is no escape. You can clearly see one slash is missing in the response.
The book name is \\
but it returns \
.
@comp4111ta There is no escape. You can clearly see one slash is missing in the response. The book name is
\\
but it returns\
.
@STommydx (https://www.json.org/json-en.html)
Any JSON library following the specs will treat double slash to the single one. Otherwise, you cannot specify new lines with \n
.
That is why \\\\
becomes \\
@comp4111ta When I add the request it adds a book with title double slash (4 slashes in the json). When it returns the response, it returns the book with title single slash (2 slashes in the json). This happens because it prints out slashes directly instead of the escaped version (double slash). You can see the code for the looking up part.
It handles the escape properly in the input, but not the output.
It handles the escape properly in the input, but not the output.
You're right. The input and output should be consistent with JSON specs.
Describe the bug Book lookup does not properly escape special characters when returning response.
To Reproduce
Expected behavior The server returns the JSON response below.
What actually happens The server returns the JSON response below.