Skip to content
Discussion options

You must be logged in to vote

Workaround for now - use the onResponse hook:

  onResponse: async (context) => {
    const json = await context.response.clone().json();
    const headersObj: Record<string, string> = {};
    context.response.headers.forEach((v, k) => {
      headersObj[k] = v;
    });
    return new Response(
      JSON.stringify({
        json,
        headers: headersObj,
      }),
      {
        ...context.response,
      }
    );
  },

Then your data object will contain json and headers as keys.

If using output, you will need to account for this, e.g. with a helper function:

const makeResponseSchema = <T extends v.GenericSchema>(outputSchema: T) => {
  return v.object({
    json: outputSchema,
    he…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by nktnet1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant