# HTTP In not accepting Content-Type application/xml

**URL:** <https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703>\
**Category:** General\
**Tags:** docker, http-in\
**Created:** [14 June 2024 18:50 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703 "2024-06-14T18:50:28Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![silversurfer600](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@silversurfer600](https://discourse.nodered.org/u/silversurfer600)\
**Post date:** [14 June 2024 18:50 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/1 "2024-06-14T18:50:28Z")

</div>

Hi all, Node Red rookie here.

I'm trying to set up a simple workflow to receive a POST in XML format and save it as a file. I can't figure out what I'm doing wrong. I'm using the example workflow "network \> http \> Post file to a flow".

My problem is with the initial HTTP In node. When I POST a JSON file with or without headers (Content-Type) it works fine. If I post an XML file with no header, it works but it adds root braces like it's encapsulating it in a JSON object, and adding /r characters which is not really what I want. If I POST with "Content-Type: application/xml" it shows as an empty payload. I've also tried "application/octet-stream" and "text/plain" and none of these seem to work either (empty payload).

 ![Screen Shot 2024-06-14 at 11.44.36 AM](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/0/5/0533fdfcfd66c52208e2f82ee1ad98c5b8fc8132.png)

I've searched and it seems like this should work, so I assume this is something I'm doing wrong. I've also tried sending the POST from different systems (curl, postman) and same issue.

I'm using the latest NodeRed docker version (3.1.10)

Thank you for any help.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [14 June 2024 19:23 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/2 "2024-06-14T19:23:38Z")

</div>

Welcome to the forums @silversurfer600

Sometime ago the content type validation routine was relaxed.  
I wonder if there are a few ghosts in the system since?

@knolleary - any thought

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [14 June 2024 19:26 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/3 "2024-06-14T19:26:56Z")

</div>

I see an issue with your payload in the image it seems to be an object. How are you posting the xml in the body of the post. Can wee see your curl or postman.

Posting it to a http in without headers I get.

 ![chrome_screenshot_14 Jun 2024 20_28_27 BST](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/6/1/61a6ebc033763058c356d53c7d2fb80472e95766.png)  
And exactly the same with application/xml

[edit]  
I get your error if i post a json to the in, with xml headers.

---

<div class="post-metadata">

**Author:** ![marcus-j-davies](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/marcus-j-davies/32/103435_2.png) [@marcus-j-davies](https://discourse.nodered.org/u/marcus-j-davies)\
**Post date:** [14 June 2024 19:36 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/4 "2024-06-14T19:36:30Z")

</div>

what if you use `application/xml` as the `Content-Type`

Unless I'm mistaken, its when that `Content-Type` is set problems occur?

(Note : It's Friday, so you know... Gin O'Clock and all that 😁 )

> [@E1cid](#):
>
> And exactly the same with application/xml

Moving along.... 🥺

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 June 2024 19:41 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/5 "2024-06-14T19:41:25Z")

</div>

works fine here:

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/c/4/c4d10404094fd70df789370a72ed45ffc3a19dbc.png)

 ![image](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/3X/3/0/30e9f3f7483d2c297f126aa8167fe1dc979e992e.png)

### flow

```auto
[{"id":"69a64e3d.84da3","type":"http in","z":"90e2df527c725ffb","name":"","url":"/hello-xml","method":"post","upload":false,"swaggerDoc":"","x":340,"y":580,"wires":[["43e49c36.dc7624","3a73da553d9a8e9b","0d8765845722da3b"]]},{"id":"43e49c36.dc7624","type":"http response","z":"90e2df527c725ffb","name":"","statusCode":"","headers":{},"x":670,"y":580,"wires":[]},{"id":"8cb4b74e.602c28","type":"comment","z":"90e2df527c725ffb","name":"Post data to a flow","info":"The `HTTP In` node can listen for POST requests. It returns the posted data as `msg.payload`.\n\nSee Node-RED cookbook items(\n[post raw data(https://cookbook.nodered.org/http/post-raw-data-to-a-flow), [post form data](https://cookbook.nodered.org/http/post-form-data-to-a-flow), [post JSON data](https://cookbook.nodered.org/http/post-json-data-to-a-flow)\n) for details.","x":350,"y":540,"wires":[]},{"id":"ec661b6b.c3c2b8","type":"http request","z":"90e2df527c725ffb","name":"","method":"POST","ret":"txt","paytoqs":"ignore","url":"http://localhost:1880/hello-xml","tls":"","persist":false,"proxy":"","insecureHTTPParser":false,"authType":"","senderr":false,"headers":[{"keyType":"Content-Type","keyValue":"","valueType":"application/xml","valueValue":""}],"x":550,"y":680,"wires":[["7c2812c.c6ee7ec"]]},{"id":"7c2812c.c6ee7ec","type":"debug","z":"90e2df527c725ffb","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":710,"y":680,"wires":[]},{"id":"e45041b6.9ec13","type":"inject","z":"90e2df527c725ffb","name":"","props":[{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","x":275,"y":680,"wires":[["7384647df4a7c001"]],"l":false},{"id":"af33dae7.b21138","type":"comment","z":"90e2df527c725ffb","name":"Send HTTP POST request: http://localhost:1880/hello-raw","info":"","x":470,"y":640,"wires":[]},{"id":"0d8765845722da3b","type":"debug","z":"90e2df527c725ffb","name":"recieved","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":680,"y":520,"wires":[]},{"id":"7384647df4a7c001","type":"template","z":"90e2df527c725ffb","name":"xml data","field":"payload","fieldType":"msg","format":"html","syntax":"mustache","template":"<?xml version=\"1.0\" encoding=\"ISO-8859-1\"?>\n<note>\n <to>Tove</to>\n <from>Jani</from>\n <heading>Reminder</heading>\n <body>Don't forget me this weekend!</body>\n</note>","output":"str","x":380,"y":680,"wires":[["ec661b6b.c3c2b8"]]},{"id":"3a73da553d9a8e9b","type":"xml","z":"90e2df527c725ffb","name":"","property":"payload","attr":"","chr":"","x":550,"y":480,"wires":[["daec8a036df5d385"]]},{"id":"daec8a036df5d385","type":"debug","z":"90e2df527c725ffb","name":"parsed","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"payload","targetType":"msg","statusVal":"","statusType":"auto","x":670,"y":480,"wires":[]}]

```

### curl

```bash
 curl -i -X POST -H "Content-Type: application/xml" -d "^<?xml version="1.0" encoding="ISO-8859-1"?^>^<note^> ^<to^>Tove^</to^> ^<from^>Jani^</from^> ^<heading^>Reminder^</heading^> ^<body^>Don't forget me this weekend-i</body^>^</note^>" http://192.168.x.y:1880/hello-xml

```

---

<div class="post-metadata">

**Author:** ![silversurfer600](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@silversurfer600](https://discourse.nodered.org/u/silversurfer600)\
**Post date:** [14 June 2024 20:43 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/6 "2024-06-14T20:43:55Z")

</div>

> [@Steve-Mcl](#):
>
> `curl -i -X POST -H "Content-Type: application/xml" -d "^<?xml version="1.0" encoding="ISO-8859-1"?^>^<note^> ^<to^>Tove^</to^> ^<from^>Jani^</from^> ^<heading^>Reminder^</heading^> ^<body^>Don't forget me this weekend-i</body^>^</note^>" http://192.168.x.y:1880/hello-xml`

Hi thanks for the responses!

I directly copied your curl and send it to my flow and I get an empty payload:

```auto
curl -i -X POST -H "Content-Type: application/xml" -d "<?xml version="1.0" encoding="ISO-8859-1"?><note><to>Tove</to><from>Jani</from><heading>Reminder</heading><body>Don't forget me this weekend-i</body></note>" http://10.0.xx.xxx:1880/hello-upload

```

So clearly this is working for everyone but me... maybe I should pull an older version? I've tried pulling a newer container image but same deal.

---

<div class="post-metadata">

**Author:** ![silversurfer600](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@silversurfer600](https://discourse.nodered.org/u/silversurfer600)\
**Post date:** [14 June 2024 21:16 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/7 "2024-06-14T21:16:28Z")

</div>

So I've deleted the container and all data.

pulled "nodered/node-red:latest-14"

Imported "Examples \> flows \> node-red \> network \> http \> 06 - Post a file to a flow"

Added a Debug

Deploy

Run curl:

```auto
curl -i -X POST -H "Content-Type: application/xml" -d "^<?xml version="1.0" encoding="ISO-8859-1"?^>^<note^> ^<to^>Tove^</to^> ^<from^>Jani^</from^> ^<heading^>Reminder^</heading^> ^<body^>Don't forget me this weekend-i</body^>^</note^>" http://10.0.xx.xxx:1880/hello-upload

```

And I get msg.payload 'empty'.

Is there more setup that I'm missing? Do I need to be editing 'settings.js' to get this to work?

---

<div class="post-metadata">

**Author:** ![E1cid](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/e1cid/32/77971_2.png) [@E1cid](https://discourse.nodered.org/u/E1cid)\
**Post date:** [14 June 2024 21:34 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/8 "2024-06-14T21:34:03Z")

</div>

Uncheck accept file uploads. As the xml is plain text.

---

<div class="post-metadata">

**Author:** ![silversurfer600](https://avatars.discourse-cdn.com/v4/letter/s/85f322/32.png) [@silversurfer600](https://discourse.nodered.org/u/silversurfer600)\
**Post date:** [14 June 2024 21:39 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/9 "2024-06-14T21:39:20Z")

</div>

See? I knew it was something stupid I was doing.

That was the issue. Thanks all!

---

<div class="post-metadata">

**Author:** ![Steve-Mcl](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/steve-mcl/32/4826_2.png) [@Steve-Mcl](https://discourse.nodered.org/u/Steve-Mcl)\
**Post date:** [14 June 2024 22:01 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/10 "2024-06-14T22:01:30Z")

</div>

> [@silversurfer600](#):
>
> See? I knew it was something stupid I was doing.

If you had imported the demo flow that I did for you would have seen it **did not** have "accept file uploads" enabled 🤷‍♂️

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [28 June 2024 22:02 UTC](https://discourse.nodered.org/t/http-in-not-accepting-content-type-application-xml/88703/11 "2024-06-28T22:02:25Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
