Skip to main content
Question

Cli create action: the "headers" field in z.request is ignored

  • October 22, 2024
  • 3 replies
  • 113 views

Hi all.

Maybe someone has already encountered the same problem, when the headers are ignored, and I always get "text/plain;charset=UTF-8".

The body was received as expected, but the headers were not.

const perform = async (z: ZObject, bundle: Bundle) => {
const response = await z.request({
method: "POST",
url: API_URL(bundle),
// headers: {
// "content-type": "application/json"
// },
headers: {
"content-type": "application/x-www-form-urlencoded",
"some-header": "exist",
},
// json
// if `body` is an object, it'll automatically get run through JSON.stringify
// if you don't want to send JSON, pass a string in your chosen format here instead
body: JSON.stringify({
access: `{{bundle.inputData.access}}`,
account: `{{bundle.inputData.account}}`,
summary: `{{bundle.inputData.summary}}`,
}),
// body: {
// access: `{{bundle.inputData.access}}`,
// account: `{{bundle.inputData.account}}`,
// summary: `{{bundle.inputData.summary}}`
// }
});

// this should return a single object
return response.data;
};

I've already checked a bunch of options, but this case is still not closed

I'll be grateful for any advice

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

3 replies

Troy Tessalone
Zapier Orchestrator & Solution Partner
Forum|alt.badge.img+14
  • Zapier Orchestrator & Solution Partner
  • October 22, 2024

Hi @Alex Ilkevych 

If you are building a Zap app integration using the Zapier Developer Platform, it is best to post your topic in this category: Developer Zone

https://community.zapier.com/p/developer-zone


JammerS
Forum|alt.badge.img+6
  • Zapier Staff
  • October 23, 2024

Hi @Alex Ilkevych,

 

I transferred this post to our Developer zone for our Developer team to discuss your concern. Thank you.


Issue was solved. Headers were rewritten in another place in the code. It’s related to the internal code of current ZAP