How to use the hyper-ts.header function in hyper-ts

To help you get started, we’ve selected a few hyper-ts examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DenisFrezzato / hyper-ts-fastify / test / index.ts View on Github external
it('ap', () => {
    const fab = pipe(
      H.header('a', 'a'),
      H.map(() => (s: string): number => s.length),
    )
    const fa = pipe(
      H.header('b', 'b'),
      H.map(() => 'foo'),
    )
    const m = pipe(
      fab,
      H.ap(fa),
    )
    const c = new MockConnection(new MockRequest())
    return assertSuccess(m, c, 3, [
      { type: 'setHeader', name: 'a', value: 'a' },
      { type: 'setHeader', name: 'b', value: 'b' },
    ])
  })
github DenisFrezzato / hyper-ts-fastify / test / index.ts View on Github external
it('should write the headers', () => {
      const m = H.header('name', 'value')
      const c = new MockConnection(new MockRequest())
      return assertSuccess(m, c, undefined, [{ type: 'setHeader', name: 'name', value: 'value' }])
    })
  })
github DenisFrezzato / hyper-ts-fastify / test / index.ts View on Github external
it('ap', () => {
    const fab = pipe(
      H.header('a', 'a'),
      H.map(() => (s: string): number => s.length),
    )
    const fa = pipe(
      H.header('b', 'b'),
      H.map(() => 'foo'),
    )
    const m = pipe(
      fab,
      H.ap(fa),
    )
    const c = new MockConnection(new MockRequest())
    return assertSuccess(m, c, 3, [
      { type: 'setHeader', name: 'a', value: 'a' },
      { type: 'setHeader', name: 'b', value: 'b' },
    ])
  })