-
Notifications
You must be signed in to change notification settings - Fork 1
/
set header on fastify.ts
41 lines (22 loc) · 1.46 KB
/
set header on fastify.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
// no estoy seguro que esto funcione porque son puras notas... Yo intentaba setear los header en graphql y pense que tenia algo que ver con el framework del servicor
// Esto son simplemente notas....
import { FastifyReply, FastifyRequest } from 'fastify';
const res = ctx.switchToHttp().getResponse<Response>()
console.log(ctx.switchToHttp().getResponse<Response>())
//const req = ctx.switchToHttp().getRequest<FastifyRequest>();
//const res = ctx.switchToHttp().getResponse<ServerResponse>();
//const req: Request = ctx.switchToHttp().getRequest()
//req.set('x-access-token', 'Your Data' );
//const response: FastifyReply = gqlExecutionContext.getContext().res;
//response.headers({dsd:'sdsd'})
//const res = ctx.switchToHttp().getResponse<FastifyReply>();
//res.header('foo', 'bar')
//res.headers({...res, CORRELATION_ID_HEADER:id })
//res.header(CORRELATION_ID_HEADER,id)
//res.send({...res, CORRELATION_ID_HEADER: id});
//console.log("HEADER MODIFICADO",res)
/* const req = ctx.getRequest<FastifyRequest>();
const res = ctx.getResponse<FastifyReply<ServerResponse>>();
const res = context.switchToHttp().getResponse<FastifyReply<any>>(); */
//https://progressivecoder.com/nestjs-interceptors-and-how-to-use-them-learn-nestjs-series-part-8/
//https://stackoverflow.com/questions/61796828/fastify-nestjs-how-to-set-response-headers-in-interceptor