Skip to content

Commit

Permalink
test that headers can be set
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyynnoj committed Sep 6, 2021
1 parent bccdb89 commit 2d49a47
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion test/types/request.test-d.ts
@@ -1,6 +1,6 @@
import { expectType } from 'tsd'
import fastify, { RouteHandler, RawRequestDefaultExpression, RequestBodyDefault, RequestGenericInterface } from '../../fastify'
import { RawServerDefault, RequestParamsDefault, RequestHeadersDefault, RequestQuerystringDefault, RawReplyDefaultExpression } from '../../types/utils'
import { RequestParamsDefault, RequestHeadersDefault, RequestQuerystringDefault } from '../../types/utils'
import { FastifyLoggerInstance } from '../../types/logger'
import { FastifyRequest } from '../../types/request'
import { FastifyReply } from '../../types/reply'
Expand Down Expand Up @@ -50,7 +50,10 @@ const getHandler: RouteHandler = function (request, _reply) {
expectType<RawRequestDefaultExpression>(request.raw)
expectType<RequestBodyDefault>(request.body)
expectType<RequestParamsDefault>(request.params)

expectType<RequestHeadersDefault & RawRequestDefaultExpression['headers']>(request.headers)
request.headers = {}

expectType<RequestQuerystringDefault>(request.query)
expectType<any>(request.id)
expectType<FastifyLoggerInstance>(request.log)
Expand Down

0 comments on commit 2d49a47

Please sign in to comment.