Skip to content

Commit

Permalink
Modified rest json protocol so DELETEs no longer send body data
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisradek committed Sep 14, 2015
1 parent 3d3988e commit 0fd44da
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions lib/protocol/rest_json.js
Expand Up @@ -27,8 +27,8 @@ function populateBody(req) {
function buildRequest(req) {
Rest.buildRequest(req);

// never send body payload on GET/HEAD
if (['GET', 'HEAD'].indexOf(req.httpRequest.method) < 0) {
// never send body payload on GET/HEAD/DELETE
if (['GET', 'HEAD', 'DELETE'].indexOf(req.httpRequest.method) < 0) {
populateBody(req);
}
}
Expand Down
2 changes: 1 addition & 1 deletion test/protocol/rest_json.spec.coffee
Expand Up @@ -128,7 +128,7 @@ describe 'AWS.Protocol.RestJson', ->
expect(request.httpRequest.headers['x-amz-meta-abc']).to.equal('xyz')

describe 'body', ->
['GET', 'HEAD'].forEach (method) ->
['GET', 'HEAD', 'DELETE'].forEach (method) ->
it 'does not populate a body on a ' + method + ' request', ->
request.params = Data: 'abc'
defop
Expand Down
2 changes: 1 addition & 1 deletion test/services/elastictranscoder.spec.coffee
Expand Up @@ -25,7 +25,7 @@ describe 'AWS.ElasticTranscoder', ->
et.cancelJob { Id: 'job-id' }, (err, data) ->
req = this.request.httpRequest
expect(req.path).to.equal('/2012-09-25/jobs/job-id')
expect(req.body).to.equal('{}')
expect(req.body).to.equal('')

describe 'updatePipelineNotifications', ->
it 'only populates the body with non-uri and non-header params', ->
Expand Down

0 comments on commit 0fd44da

Please sign in to comment.