Closed g-wozniak closed 3 years ago
Hey @g-wozniak đź‘‹
Thanks for raising - a curious one as we have test coverage for this ( see https://github.com/asos-craigmorten/superdeno/blob/main/test/supertest.opine.test.ts#L164 ) so guessing something has changed subtly in a recent version of Deno or Opine to cause this.
So can try to reproduce, what version of Opine were you using?
Hey. Thanks for the response.
Yes I'd imagine as it's quite important bit :)
I am using opine@1.3.2
.
Adding: res.type("application/json")
to the handler didn't help either.
I've ruled out Opine because if I launch manually the server and make the call to a similar endpoint I am getting:
content-length: 13
content-type: application/json; charset=utf-8
etag: W/"d-db138f5ff0fed06ff05baf0912c"
x-correlation: f6571c1e-7c63-4f69-9f18-48c5855cb1c6
x-powered-by: Opine
Even if I run:
import { superdeno, opine } from '../dependencies.ts'
const app = opine()
app.get('/', (req, res, next) => {
res.type("application/json")
res.json({ data: 'ok' })
})
await superdeno(app)
.get('/')
.expect(200)
.then(response => {
console.log(response.headers)
})
it throws - { "content-type": undefined }
So unless I am blind, doing something obvious wrongly - can't get to the bottom of it. :)
Hi @g-wozniak, can you see if superdeno@4.2.0
solves the issue for you? If not please re-open!
SuperDeno does not process headers from Opine
Setup:
Details
When: testing the following Opine handler:
I want the following test:
to return:
instead of
{ "content-type": undefined }
.Full response: