Closed osher closed 7 years ago
This one is going to be tedious... I added pending tests.
Can you please confirm that I reverse engineered the specs correctly?
mmm. maybe you'd prefer a different strategy to test all this. I saw you didn't write tests for connect_adapter - perhaps because you relay on e2e tests for that?
@coveralls are you for real? this commit is from December 2016!
Maybe coveralls is trying to tell me something. ;) The reason I haven't merged this is that it seems like it could be a breaking change for someone... and I haven't heard anyone else complain about it. Do you have any thoughts on the potential impact on other folks?
hmm. What's breaking? The case where user did not send content-type and the infra sends for her the same content-type defined by the user in the open-spec doc? I'd think that's rather intentional...
LOL. Ok. You're right. I reviewed the code again. I think I was being overly skittish. Thanks for the contrib!
When the user uses
next(null, output)
instead of usingres.end(..)
and does not set thecontent-type
response header - the code path reaches the point wherectx.output
is translated according tores.getHeader('content-type')
.In this case - it's rendered using
util.inspect(..)
- which is not the format declared by the operation.This fix tries the
res.getHeaders('content-type') first, and if missing - fallsback to using the first entry on the
operation.produces` as default.(still need to add tests)