You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Great, great piece of software - to the point, simple and well-documented. Kudos!
I have noticed that the responses from the server can be a bit confusing/misleading if the 'Content-Type' header is missing. The server responds with 'ok' (HTTP 200) even thought the requested operation was (semantically) not successful.
I must admit that I have not much experience with node.js applications. It's possibly normal or expected to get the request with a 'Content-Type: application/json' header.
Examples below (name of registered package is 'test-bower'):
unregister / remove package without headers
curl -v -X POST -d '{"name":"test-bower"}' http://localhost:5678/removePackage
even if no header property can be found in the body of the request, the resulting 'undefined' value will be attempted to be removed from the packages internal store.
Only after setting the correct Content-Type header is the package being removed:
curl -v -X POST -H 'Content-Type: application/json' -d '{"name":"test-bower"}' http://localhost:5678/removePackage
Maybe the response codes could be adjusted accordingly if the package cannot be found or if the required body parameters cannot be found? This would make it less confusing and clearer to the user what is going on.
The text was updated successfully, but these errors were encountered:
Hey Barna
Great, great piece of software - to the point, simple and well-documented. Kudos!
I have noticed that the responses from the server can be a bit confusing/misleading if the 'Content-Type' header is missing. The server responds with 'ok' (HTTP 200) even thought the requested operation was (semantically) not successful.
I must admit that I have not much experience with node.js applications. It's possibly normal or expected to get the request with a 'Content-Type: application/json' header.
Examples below (name of registered package is 'test-bower'):
Response:
Server output:
However, the package has not been removed and was still available in the registry. Looking at the source code in
lib/server.js:148
(as an example)even if no header property can be found in the body of the request, the resulting 'undefined' value will be attempted to be removed from the packages internal store.
Only after setting the correct Content-Type header is the package being removed:
Maybe the response codes could be adjusted accordingly if the package cannot be found or if the required body parameters cannot be found? This would make it less confusing and clearer to the user what is going on.
The text was updated successfully, but these errors were encountered: