Permalink
Browse files

Put requests now support raw text data in parameter

* closes #6
  • Loading branch information...
1 parent 5baaddd commit 9b1d7aafb69bb2b893d92d10a7959392c3cce3e8 @bulkan committed Nov 1, 2012
Showing with 23 additions and 1 deletion.
  1. +7 −1 src/RequestsLibrary/keywords.py
  2. +16 −0 tests/testcase.txt
@@ -1,4 +1,5 @@
import requests
+import sys
import json
from urllib import urlencode
@@ -129,7 +130,12 @@ def put(self, alias, uri, data=None, headers=None):
"""
session = self._cache.switch(alias)
- resp = session.put(uri, data=urlencode(data), headers=headers)
+ if type(data) is dict:
+ resp = session.put(uri, data=urlencode(data), headers=headers)
+ else:
+ resp = session.put(uri, data=data, headers=headers)
+
+ print resp.content
# store the last response object
session.last_resp = resp
View
@@ -34,13 +34,29 @@ Post Request With No Data
${resp} Post httpbin /post
Should Be Equal As Strings ${resp.status_code} 200
+
+Put Request With No Data
+ Create Session httpbin http://httpbin.org
+ ${resp} Put httpbin /put
+ Should Be Equal As Strings ${resp.status_code} 200
+
+
Post Request With No Dictionary
Create Session httpbin http://httpbin.org
Set Test Variable ${data} some content
${resp} Post httpbin /post data=${data}
Should Be Equal As Strings ${resp.status_code} 200
Should Contain ${resp.content} ${data}
+
+Put Request With No Dictionary
+ Create Session httpbin http://httpbin.org
+ Set Test Variable ${data} some content
+ ${resp} Put httpbin /put data=${data}
+ Should Be Equal As Strings ${resp.status_code} 200
+ Should Contain ${resp.content} ${data}
+
+
Post Requests
Create Session httpbin http://httpbin.org

0 comments on commit 9b1d7aa

Please sign in to comment.