How to send dot character as parameter from angularjs $ http

I'm trying to send . (dot) as a string to the next aspi call in Nodejs. I am using an Angularjs $http object.

I see that the call is made with a period character (.), Which I entered in the search field.

https: // localhost: 3003 / posts / search / .

However, when I see an ajax call through the Google developer tool, it makes a call like:

https: // localhost: 3003 / posts / search /

How to transfer a dot symbol?

the code:

return

 $http.get('https://localhost:3003/posts/search/.').then(getPostCompleted).catch(function (message) { handleException(message); }); 

I don’t think I need btoa or atob on this?

Thanks am

+1
angularjs
source share
3 answers

You should use get params using something like:

 https://localhost:3003/posts/search?req=. 

and get req parameters in your code. I know that this is not the route that you need, but I think the point is a special character that cannot be used on the route, because it is used for the domain

+1
source

How to transfer a dot character?

String in urls mush be url-encoded . Raw javascript has a function that does this, but angular.js $ http service special behavior for this.

EDIT:

I see that the call is made with a period character (.), Which I entered in the search field.

https: // localhost: 3003 / posts / search / .

However, when I see an ajax call through the Google developer tool, it makes a call like:

https: // localhost: 3003 / posts / search /

Chrome by default should delete points without extension. Regular syntax splitting can be somewhere.

+1
source

See about using a dot.

If you want to use GET, you can pass this parameter as a query string ie

 $http.get('https://localhost:3003/posts/search?string=.') .then(getPostCompleted).catch(function (message) { handleException(message); }); 

Otherwise, you can use POST and add a parameter to the body

 $http.post('https://localhost:3003/posts/search', {string: '.'}) .then(getPostCompleted).catch(function (message) { handleException(message); }); 
+1
source

All Articles