Beispiel #1
0
 def urlencoded_form(self, odict):
     """
     Sets the body to the URL-encoded form data, and adds the appropriate content-type header.
     This will overwrite the existing content if there is one.
     """
     self.headers["content-type"] = "application/x-www-form-urlencoded"
     self.content = utils.urlencode(odict.lst)
Beispiel #2
0
 def set_query(self, odict):
     """
         Takes an ODict object, and sets the request query string.
     """
     scheme, netloc, path, params, _, fragment = urlparse.urlparse(self.get_url())
     query = utils.urlencode(odict.lst)
     self.set_url(urlparse.urlunparse([scheme, netloc, path, params, query, fragment]))
Beispiel #3
0
 def urlencoded_form(self, odict):
     """
     Sets the body to the URL-encoded form data, and adds the appropriate content-type header.
     This will overwrite the existing content if there is one.
     """
     self.headers["content-type"] = "application/x-www-form-urlencoded"
     self.content = utils.urlencode(odict.lst)
Beispiel #4
0
 def query(self, odict):
     query = utils.urlencode(odict.lst)
     scheme, netloc, path, params, _, fragment = urllib.parse.urlparse(
         self.url)
     _, _, _, self.path = utils.parse_url(
         urllib.parse.urlunparse(
             [scheme, netloc, path, params, query, fragment]))
Beispiel #5
0
 def _set_query(self, value):
     query = utils.urlencode(value)
     scheme, netloc, path, params, _, fragment = urllib.parse.urlparse(
         self.url)
     _, _, _, self.path = utils.parse_url(
         urllib.parse.urlunparse(
             [scheme, netloc, path, params, query, fragment]))
Beispiel #6
0
 def set_query(self, odict):
     """
         Takes an ODict object, and sets the request query string.
     """
     scheme, netloc, path, params, _, fragment = urlparse.urlparse(self.url)
     query = utils.urlencode(odict.lst)
     self.url = urlparse.urlunparse(
         [scheme, netloc, path, params, query, fragment])
Beispiel #7
0
 def set_form_urlencoded(self, odict):
     """
         Sets the body to the URL-encoded form data, and adds the
         appropriate content-type header. Note that this will destory the
         existing body if there is one.
     """
     # FIXME: If there's an existing content-type header indicating a
     # url-encoded form, leave it alone.
     self.headers["Content-Type"] = [HDR_FORM_URLENCODED]
     self.content = utils.urlencode(odict.lst)
Beispiel #8
0
 def set_form_urlencoded(self, odict):
     """
         Sets the body to the URL-encoded form data, and adds the
         appropriate content-type header. Note that this will destory the
         existing body if there is one.
     """
     # FIXME: If there's an existing content-type header indicating a
     # url-encoded form, leave it alone.
     self.headers["Content-Type"] = [HDR_FORM_URLENCODED]
     self.content = utils.urlencode(odict.lst)
Beispiel #9
0
def test_urlencode():
    assert utils.urlencode([('foo', 'bar')])
Beispiel #10
0
def test_urlencode():
    assert utils.urlencode([('foo', 'bar')])
Beispiel #11
0
 def query(self, odict):
     query = utils.urlencode(odict.lst)
     scheme, netloc, path, params, _, fragment = urllib.parse.urlparse(self.url)
     _, _, _, self.path = utils.parse_url(
             urllib.parse.urlunparse([scheme, netloc, path, params, query, fragment]))