Comments (15)
could you please try this?
var Client = require('node-rest-client').Client
var defaultOptions = {
user: 'myuser',
password: 'mypassword',
mimetypes: {
json: ["application/json", "application/json;charset=utf-8"]
}
};
var client = new Client(defaultOptions);
var args ={headers:{"Content-Type": "application/json"}};
client.delete('http://localhost:8080/rest/service/5117',args, function(data, response) { ... });
from node-rest-client.
@aacerox same problem
Here are the requests
Generated by client.delete
DELETE /rest/service/5117 HTTP/1.1
Host: localhost:8080
Authorization: Basic dXNlcjpwYXNzd29yZA==
Connection: keep-alive
Transfer-Encoding: chunked
0
Generated by request (working)
DELETE /rest/service/5117 HTTP/1.1
Host: localhost:8080
Content-Type: application/json
Authorization: Basic dXNlcjpwYXNzd29yZA==
content-length: 0
from node-rest-client.
hi @rkmax
I've tried DELETE method several times with different REST sites and works without problems. for example:
var Client = require('node-rest-client').Client;
var defaultOptions = {
user: 'myuser',
password: 'mypassword',
mimetypes: {
json: ["application/json", "application/json;charset=utf-8"]
}
};
var client = new Client(defaultOptions);
var args ={headers:{"Content-Type": "application/json"}};
client.delete('http://jsonplaceholder.typicode.com/posts/1',args, function(data, response) {
console.log(data);
});
I see your testing against a local server. Is it private or are you using any that I can download to try by my self?
How do you get the requests logs you sent me the last comment?
Thanks.
from node-rest-client.
@aacerox i using for communicate with activiti.org activiti-rest.
I get the request logs using http://www.charlesproxy.com/
from node-rest-client.
the activity REST API documentation mention this:
Due to default security properties on Tomcat, escaped forward slashes (%2F and %5C) are
not allowed by default (400-result is returned). This may have an impact on the deployment
resources and their data-URL, as the URL can potentially contain escaped forward slashes.
When issues are experienced with unexpected 400-results, set the following system-property:
-Dorg.apache.tomcat.util.buf.UDecoder.ALLOW_ENCODED_SLASH=true.
could you check to set this property an see if it works? I know you're not using escaped forward slashes in your URL but I need to discard possible causes.
Also you can enable debug on the client by setting the env variable debug and send me the result
linux: export DEBUG=true
windows:set DEBUG=true
from node-rest-client.
@aacerox i'm using Glassfish.
I'm using node-rest-client to consume almost 60% of the API. Other methods GET, PUT POST, works fine with the exception of DELETE
from node-rest-client.
FYI: I am having the same problem. Interestingly, changing the method from DELETE to GET and the call works fine; change it back to DELETE and it fails. Added "content-length: 0" to my header and it worked!
from node-rest-client.
Please note that the latest version of Apache requires "content-length" in the header or Apache will reject the request with a 500 error - your server will never see the request! I have had issues with node-rest-client's POST and DELETE because of this.
from node-rest-client.
Thanks @ncorison
Time ago I had a similar problem with nginx and solved it adding Content-Length to every POST and PUT method requests, but I forgot DELETE method (my fault ...).
Tonight I'll set Content-Length header to DELETE method too, and I'll upload a new version with these changes.
from node-rest-client.
I've created a branch "issue64-delete-method" with the fix I point to @ncorison in the last post (setting always "Content-length" header in every POST/PUT/DELETE/PATCH method request).
Could you please test your code against this branch to see if we have found a solution?
Thanks.
from node-rest-client.
Thanks @aacerox I'll try it this weekend
from node-rest-client.
have you been able to test your code agains branch "issue64-delete-method" during the weekend?
from node-rest-client.
No, I have not - it will need to wait until tomorrow at the earliest.
Norman
From: Alejandro Alvarez Acero [mailto:[email protected]]
Sent: Monday, April 13, 2015 2:02 AM
To: aacerox/node-rest-client
Cc: Norman Corison
Subject: Re: [node-rest-client] delete method is not working well (#64)
Hi @rkmaxhttps://github.com/rkmax and @ncorisonhttps://github.com/ncorison
have you been able to test your code agains branch "issue64-delete-method" during the weekend?
Reply to this email directly or view it on GitHubhttps://github.com//issues/64#issuecomment-92278734.
from node-rest-client.
Looks like it's working OK for me.
Norman
From: Alejandro Alvarez Acero [mailto:[email protected]]
Sent: Friday, April 10, 2015 2:14 PM
To: aacerox/node-rest-client
Cc: Norman Corison
Subject: Re: [node-rest-client] delete method is not working well (#64)
Hi @rkmaxhttps://github.com/rkmax and @ncorisonhttps://github.com/ncorison
I've created a branch "issue64-delete-method" with the fix I point to @ncorisonhttps://github.com/ncorison in the last post (setting always "Content-length" header in every POST/PUT/DELETE/PATCH method request).
Could you please test your code against this branch to see if we have found a solution?
Thanks.
Reply to this email directly or view it on GitHubhttps://github.com//issues/64#issuecomment-91693427.
from node-rest-client.
I assume this is fixed, so I close this issue. If not please reopen.
from node-rest-client.
Related Issues (20)
- Vulernability in debug-2.2.0
- promise from http calls HOT 2
- TLS 1.2 Support HOT 1
- Support for retry HOT 1
- Cannot get examples to work HOT 2
- Handle JSON Hijacking prevention HOT 1
- xmlSerializer is not defined
- NPM Vulnerability HOT 2
- Problem behind a Proxy with Tunnel HOT 4
- Can I send a binary file with this?
- "node_modules\node-rest-client\lib\nrc-serializer-manager.js:122" HOT 1
- Result is not defined in nrc-parser-manager HOT 1
- Use a loop? HOT 1
- HTTPS: unable to verify the first certificate error HOT 2
- https encryption
- Content-Type header is case sensitive
- Cannot send multipart/form-data
- The git repository has been abandoned
- "Error: socket hang up" when using node-rest-client if follow-redirects Ver > 1.13.3 HOT 1
- Replace xml2js due to CVE-2023-0842
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-rest-client.