-
Notifications
You must be signed in to change notification settings - Fork 152
Open
Description
Hi all,
I want to make a POST with URL encoded params and I have followed the guide, but it doesnt work. Executed it from cURL it works as expeted, but transforming it to HTTPBuilder doesn't work.
Code from cURL:
curl -X POST -u "user:pass" https://bitbucket.org/site/oauth2/access_token -d grant_type=client_credentials
Code made with HTTPBuilder:
String url = 'https://bitbucket.org/'
HTTPBuilder http = new HTTPBuilder(url)
authSite.auth.basic 'user', 'pass'
http.post( path: '/site/oauth2/access_token', body: [grant_type:'client_credentials'],
requestContentType: URLENC ) { resp ->
println "POST Success: ${resp.statusLine}"
assert resp.statusLine.statusCode == 201
}
With the former code the response is "Bad request" while with cURL the response is as expected.
Is anything missed in the HTTPBuilder configuration?
Thanks in advance!
Regards,
Miguel.
Metadata
Metadata
Assignees
Labels
No labels