Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

catch 409 error #54

Closed
wants to merge 2 commits into from
Closed

catch 409 error #54

wants to merge 2 commits into from

Conversation

bourgeoa
Copy link
Member

catch 409 error and normalize headers content-type to lower case

@bourgeoa bourgeoa mentioned this pull request Nov 17, 2020
@jeff-zucker
Copy link
Member

Thanks. I've put this into rest.js so it happens every time a request is received. It handles the general case so headers["Content-Type"] is always treated as headers["content-type"] and options.Method as options.method. The actual methods ('GET','PUT') are upercased but the header keys are lower-cased.

function normalizeOptions(opts){
  let newOpts = {}
  for(var o in opts){
    newOpts[o.toLowerCase()] = opts[o];
  }
  newOpts.method  = newOpts.method ? newOpts.method.toUpperCase() : 'GET'
  return newOpts;
} 

Note : I added your changes manually, so closing this PR without merging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants