Skip to main content

 Hey,

I make a trigger with files.

I send a request to the server and the response type is stream.

and when I tried to send it to z.stashfile I get a txt file with the content

how do I get a pdf file?

the contens is:

%PDF-1.5
%����..

const options = {

    url: `https://XXXXXGetDocumentPreview?signFlowId=${bundle.inputData.signFlowId}`,

    method: 'GET',

    headers: {

      'Content-Type': 'application/pdf',

      Accept: 'application/pdf',

      Authorization: `Bearer ${bundle.authData.access_token}`,

      'X-Tenant': bundle.authData.realm,

    },

    raw: true,

    params: {},

    body: {},

  };

  const fileContent = await z.request(options)

    .then((response) => {

      response.throwForStatus();

      const file = response;

      return file;

    })

  const stash = await z.stashFile(fileContent);

  const fileInfo = {

    file: await z.dehydrateFile(hydrators.downloadFile, { url: stash }),

  };

  return fileInfo;

need to sent the response and not the response.content