~ubuntu-branches/ubuntu/lucid/lazr.restfulclient/lucid-proposed

« back to all changes in this revision

Viewing changes to src/lazr/restfulclient/resource.py

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-12-11 16:30:02 UTC
  • Revision ID: package-import@ubuntu.com-20141211163002-9esry51vksl1z3hd
Tags: 0.9.11-1ubuntu1.4
Always uppercase HTTP methods to match httplib2 expectations
(LP: #1401544).

Show diffs side-by-side

added added

removed removed

Lines of Context:
523
523
             in_representation) = self.wadl_method.build_representation(
524
524
                **args)
525
525
            extra_headers = { 'Content-type' : media_type }
 
526
        # Pass uppercase method names to httplib2, as that is what it works
 
527
        # with. If you pass a lowercase method name to httplib then it doesn't
 
528
        # consider it to be a GET, PUT, etc., and so will do things like not
 
529
        # cache. Wadl Methods return their method lower cased, which is how it
 
530
        # is compared in this method, but httplib2 expects the opposite, hence
 
531
        # the .upper() call.
526
532
        response, content = self.root._browser._request(
527
 
            url, in_representation, http_method, extra_headers=extra_headers)
 
533
            url, in_representation, http_method.upper(),
 
534
            extra_headers=extra_headers)
528
535
 
529
536
        if response.status == 201:
530
537
            return self._handle_201_response(url, response, content)