Skip to content

byte size of the response #4627

Closed Answered by Eomm
HassanIyan asked this question in Q&A
Mar 14, 2023 · 2 comments · 1 reply
Discussion options

You must be logged in to vote

Do you mean like this?

const fastify = require('fastify')({ logger: !true });

fastify.get(
  '/',
  {
    onResponse: function hook(request, reply, done) {
      console.log(reply.raw.getHeader('Content-Length'));
      done();
    },
  },
  async (request, reply) => {
    return 'a'.repeat(42);
  }
);

fastify.inject('/').then((response) => {});

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@metcoder95
Comment options

Answer selected by metcoder95
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants