-
Notifications
You must be signed in to change notification settings - Fork 504
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Don't attempt to json encode string types #1479
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello there keslerm 👋
Thank you and congrats 🎉 for opening your first PR on this project.✨
We will review the following PR soon! 👀
I'm only really familiar with Express but reviewing the code for the other two types of servers they don't appear to have the same issue Express is having here. |
Hi there, can you please add integration tests to show we have a consistent behavior? |
I'd love to, I looked around a bit at the tests and it's a lot to digest - could you give me a ballpark spot to look at that I can use as a starting point? |
Sure, you can add a new controller method here: that returns a string. Then, call them: Then, verify the response headers. |
185dc8f
to
5688f98
Compare
We are running into this issue as well. Is this fine to merge? |
@WoH I got side tracked by work, is there anything I need to do on this still? |
Can you check the content type headers in the tests? The body could've been correct before, now we want text/plain not application/json |
5688f98
to
306b854
Compare
@WoH I added some appropriate calls for each server type (hapi and express required an extra step, koa seemed to do it correctly from the git go) There are a couple of tests failing as a result of this change however. I looked at them a bit and I'm not entirely sure what is ultimately causing them to fail
|
I'll take a look, first guess is the data is now on res.body, and it's checking/parsing res.data in the tests |
@@ -208,6 +208,9 @@ export function RegisterRoutes(app: Router) { | |||
if (data && typeof data.pipe === 'function' && data.readable && typeof data._read === 'function') { | |||
response.status(statusCode || 200) | |||
data.pipe(response); | |||
} else if (data && typeof data === 'string') { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
data could be ''
which is nullish, do we want this to fall through to 204 no content?
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
This PR is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 5 days |
Any plans on reopening this? |
@WoH Is this still being worked on? I'd love to help if it's still planned. |
All Submissions:
Closing issues
close #1394