# How to make http-request not encode uri?

**URL:** <https://discourse.nodered.org/t/how-to-make-http-request-not-encode-uri/54867>\
**Category:** General\
**Tags:** http-request\
**Created:** [8 December 2021 11:12 UTC](https://discourse.nodered.org/t/how-to-make-http-request-not-encode-uri/54867 "2021-12-08T11:12:32Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![kjellskogsrud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kjellskogsrud/32/52264_2.png) [@kjellskogsrud](https://discourse.nodered.org/u/kjellskogsrud)\
**Post date:** [8 December 2021 11:12 UTC](https://discourse.nodered.org/t/how-to-make-http-request-not-encode-uri/54867/1 "2021-12-08T11:12:32Z")

</div>

Hi, I am using node-red to get some data from a REST-like API endpoint.  
The general endpoint is like this:  
some.domain.here/_controller_/_value_/_signalname_

filling in the values for the controller, value, and the signal has worked like expected until one of the signals has a / in the name. This predictably gives 404 as it is parsed as a part of the URL.

I tested in postman and found that when I replace the / in my signal with %2F it works. Great now I have a fix, but it does not work in node-red.

In node-red the HTTP request URL seem to be "helpful" and encodes my URL for me, and that makes my URL: some.domain.here/controller/value/signal%2Fname  
into:  
URL: some.domain.here/controller/value/signal%252Fname (the problem here being % is encoded for me into %25)

Is there a way to stop the http-request from doing this, or is there an alternative module I could use?  
Or am I stuck having to write the http-request myself in a function block?

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 December 2021 11:13 UTC](https://discourse.nodered.org/t/how-to-make-http-request-not-encode-uri/54867/2 "2021-12-08T11:13:55Z")

</div>

How exactly are you setting the url? Directly in the node? Via `msg.url`, or something else?

---

<div class="post-metadata">

**Author:** ![kjellskogsrud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kjellskogsrud/32/52264_2.png) [@kjellskogsrud](https://discourse.nodered.org/u/kjellskogsrud)\
**Post date:** [8 December 2021 11:15 UTC](https://discourse.nodered.org/t/how-to-make-http-request-not-encode-uri/54867/3 "2021-12-08T11:15:00Z")

</div>

I have tried both directly, and msg.url

I also tried setting the URL as msg.rawURL and using {{{rawURL}}} in the http-request

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 December 2021 11:24 UTC](https://discourse.nodered.org/t/how-to-make-http-request-not-encode-uri/54867/4 "2021-12-08T11:24:02Z")

</div>

I have created an HTTP In flow that listens for request on `/test/*` - so anything starting with `/test/`. It logs to Debug the value of `msg.req.originalUrl` - the actual url being sent in the request.

In a separate flow, if I enter `http://localhost:1880/test/foo%2Fbar` into the url field of an HTTP Request node, when I trigger it, I see the request arrive on the path `/test/foo%2Fbar` - so no modification appears to have happened.

I've tried a number of variations of this, and I can't get it to do the double encoding you're seeing. So there must be some aspect to this I'm missing.

Can you share an example flow that demonstrates the issue?

Also, can you confirm what version of Node-RED you're using?

---

<div class="post-metadata">

**Author:** ![kjellskogsrud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kjellskogsrud/32/52264_2.png) [@kjellskogsrud](https://discourse.nodered.org/u/kjellskogsrud)\
**Post date:** [8 December 2021 11:37 UTC](https://discourse.nodered.org/t/how-to-make-http-request-not-encode-uri/54867/5 "2021-12-08T11:37:36Z")

</div>

I did mostly the same now to test, and it still double encodes: [Test flow - pastebin](https://pastebin.com/RwDWvFjp)

```auto
originalUrl: "/test/foo%252Fbar"

```

I am on version 2.0.3.

---

<div class="post-metadata">

**Author:** ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)\
**Post date:** [8 December 2021 11:44 UTC](https://discourse.nodered.org/t/how-to-make-http-request-not-encode-uri/54867/6 "2021-12-08T11:44:10Z")

</div>

> [@kjellskogsrud](#):
>
> I am on version 2.0.3.

This issue was fixed in 2.0.4 🙂

> - HTTP Request: Handle partially encoded url query strings in request node

> **[Release 2.0.4: Maintenance Release · node-red/node-red](https://github.com/node-red/node-red/releases/tag/2.0.4)**
>
> Editor
> 
> Fix tab fade CSS for when using themes (#3085) @bonanitech
> Handle just-copied-but-not-deployed node with credentials in editor Fixes #3090
> 
> Nodes
> 
> Filter: Fix RBE node handling of default t...

---

<div class="post-metadata">

**Author:** ![kjellskogsrud](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/kjellskogsrud/32/52264_2.png) [@kjellskogsrud](https://discourse.nodered.org/u/kjellskogsrud)\
**Post date:** [8 December 2021 11:58 UTC](https://discourse.nodered.org/t/how-to-make-http-request-not-encode-uri/54867/7 "2021-12-08T11:58:49Z")

</div>

Thanks 🙂  
I will do an upgrade and see if that helps (which it probably will).  
Edit: It did. Case closed 🙂

---

<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:** [22 December 2021 11:58 UTC](https://discourse.nodered.org/t/how-to-make-http-request-not-encode-uri/54867/8 "2021-12-22T11:58:52Z")

</div>

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