how to resolve a HTTP 400 Bad Request error? - node.js

I have developed an Angular4 application that does HTTP requests to a nodeJS server application.
An URL works for http.get() but the same URL for http.put() or http.post() throws HTTP 400 Bad Request error.
How is this possible??
let temp=this._http.post("http://localhost:4200/medicine/edit/"
+String(updatedEmployee.id),updatedEmployee.id);
[angular code link]codeshare.io/5wlnLR
[express route code] codeshare.io/G8npdD

Related

unknown request using express

I installed the nginx(Port 80 connection passed to express 3000 port) and express apps on AWS lightsail. Sometimes an unknown request occurs. like..
GET /_ignition/execute-solution
GET /config/getuser?index=0
GET /owa/auth/logon.aspx?url=https%3a%2f%2f1%2fecp%2f
GET /vendor/phpunit/phpunit/src/Util/PHP/eval-stdin.php
...more...
There were mainly many requests for php. these requests end with a 404 response.
All my API use JWT authentication. Is express safe for these requests? Is there anything I can do?

Angular with node.js http failure response for unknown url ): 0 unknown error

So let's start with little info in the beginning.
I have nodejs server side app and client app on angular. I send only get requsts to server app just to read data from database. When i started my apps on local machine they were working pretty well. But when i deployed them to server i got such error : (below in screen)
screen with error from angular
So, i added cors support in server app and add Allow Headers. code in nodejs
But it doesn`t help. When i post "GET" request i get my allow headers in response header and my data that i need in body.
screen with response headers in postman
screen with response body in postman
Server - apache. One interesting thing that server app works good with http protocol and when i am using htttps get this errror error with https
But angular works on https.

Http request succeed when using postman, fails when using node.js axios

I have deployed BeaconCtrl project on heroku, it has a server to server api,
I tried requesting some routes using postman, with the same headers, body and the same route, it responds with 500 internal server error !.
does requesting from server to another server differ from requesting from postman to a server ?

code HPE_INVALID_METHOD Node js Hapi js

I am trying to make GET request to my API endpoint and when I do the request from another server to the API I see this strange error (on the API):
170125/230803.439, [log,connection,client,error] data: {"bytesParsed":0,"code":"HPE_INVALID_METHOD"}
What does this error mean?
I am sorry I did request on https:// I should have done it on http:// instead

Get request info from HTTP response in node

It is possible, in a node.js application, to get any information about the HTTP request from the response itself?

Resources