cmorten / superdeno

Super-agent driven library for testing Deno HTTP servers.
https://cmorten.github.io/superdeno/
MIT License
124 stars 6 forks source link

Support new std@0.107/http API #32

Closed talentlessguy closed 3 years ago

talentlessguy commented 3 years ago

Issue

Setup:

Details

With new std/http superdeno doesn't work anymore. superdeno should support new API and deprecate the old one

talentlessguy commented 3 years ago

sicck thanks for updating it, @asos-craigmorten !

cmorten commented 3 years ago

Released in https://deno.land/x/superdeno@4.5.0 - please reopen if have any issues!

talentlessguy commented 3 years ago

@cmorten it seems to erase some headers?

import { superdeno } from 'https://deno.land/x/superdeno@4.5.0/mod.ts'
import { describe, it, run } from 'https://deno.land/x/tincan@0.2.2/mod.ts'
import { compression } from 'https://deno.land/x/compression/mod.ts'

describe('options', () => {
  it('applies compression to a file', async () => {
    const request = superdeno(compression({ path: 'README.md', compression: ['gzip'] }))

    await request
      .get('/')
      .set('Accept-Encoding', 'gzip')
      .expect('Content-Length', '694')
      .expect('Content-Encoding', 'gzip')
  })
})

run()

yields

Error: expected "Content-Length" header field
    at Test.#assertHeader (https://deno.land/x/superdeno@4.5.0/src/test.ts:582:14)
    at Test.#assertFunction (https://deno.land/x/superdeno@4.5.0/src/test.ts:637:13)
    at Test.#assert (https://deno.land/x/superdeno@4.5.0/src/test.ts:500:35)
    at https://deno.land/x/superdeno@4.5.0/src/test.ts:475:23
    at async close (https://deno.land/x/superdeno@4.5.0/src/close.ts:47:46)

failures:

        options > applies compression to a file

test result: FAILED. 1 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out (509ms)

source: https://github.com/deno-libs/compression