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

Method fixes and enhancements #164

Merged
merged 7 commits into from
Mar 2, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@

## 1.7.0 Unreleased but on master branch (tentative Pip release in December/Jan)
**Features:**
* Unicode support epic: fix handling of request body and a whole raft of smaller fixes + more tests: https://github.com/svanoort/pyresttest/issues/104
* ALPHA: Python 3 support - all tests now pass!
-
* JsonPath_Mini extractor supports ability to return the root response object now with the "." syntax -- thanks for the PR! https://github.com/svanoort/pyresttest/pull/106
* Allow for smarter URL creation from fragments: https://github.com/svanoort/pyresttest/issues/118
* Unicode support epic: fix handling of request body and a whole raft of smaller fixes + more tests: https://github.com/svanoort/pyresttest/issues/104

* Add terminal output coloring for pass/pail (able to turn off via cmdline)
- Thanks to @lerrua for his PRs https://github.com/svanoort/pyresttest/pull/125 https://github.com/svanoort/pyresttest/pull/141

Expand All @@ -16,6 +18,10 @@
* Fix HTTP PATCH method configuration - many thanks to @lerrua for his PR!
- Noted in https://github.com/svanoort/pyresttest/issues/117
- Fixed in https://github.com/svanoort/pyresttest/pull/129
* Fix the HTTP DELETE use with a body, which could not be tested
- Thanks to @spradeepv for the pull request: https://github.com/svanoort/pyresttest/pull/165
* Fix HTTP HEAD method configuration
- Thanks to @ksramchandani for reporting issues that triggered an investigation (different root cause) in https://github.com/svanoort/pyresttest/issues/117

**Known Issues / Back-Compatibility:**
* Headers are returned from tests as unicode key, value pairs now
Expand Down
10 changes: 9 additions & 1 deletion pyresttest/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,8 +349,16 @@ def configure_curl(self, timeout=DEFAULT_TIMEOUT, context=None, curl_handle=None
curl.setopt(pycurl.INFILESIZE, 0)
elif self.method == u'DELETE':
curl.setopt(curl.CUSTOMREQUEST, 'DELETE')
elif self.method and self.method.upper() != 'GET': # Support HEAD/ETC
if bod is not None:
curl.setopt(pycurl.POSTFIELDS, bod)
curl.setopt(pycurl.POSTFIELDSIZE, len(bod))
elif self.method == u'HEAD':
curl.setopt(curl.NOBODY, 1)
curl.setopt(curl.CUSTOMREQUEST, 'HEAD')
elif self.method and self.method.upper() != 'GET': # Alternate HTTP methods
curl.setopt(curl.CUSTOMREQUEST, self.method.upper())
if bod is not None:
curl.setopt(pycurl.INFILESIZE, len(bod))

# Template headers as needed and convert headers dictionary to list of header entries
head = self.get_headers(context=context)
Expand Down