# Path: xpaw/http.py
# class HttpRequest:
# class HttpResponse:
#     def __init__(self, url, method="GET", body=None, params=None, headers=None, proxy=None,
#                  timeout=20, verify_ssl=False, allow_redirects=True, auth=None, proxy_auth=None,
#                  priority=None, dont_filter=False, callback=None, errback=None, meta=None,
#                  render=None):
#     def __str__(self):
#     def meta(self):
#     def copy(self):
#     def replace(self, **kwargs):
#     def to_dict(self):
#     def from_dict(cls, d):
#     def __init__(self, url, status, body=None, headers=None,
#                  request=None, encoding=None):
#     def __str__(self):
#     def encoding(self):
#     def encoding(self, value):
#     def text(self):
#     def meta(self):
#     def copy(self):
#     def replace(self, **kwargs):
# 
# Path: xpaw/utils.py
# def get_params_in_url(url):
#     return parse_qs(urlsplit(url).query)


from xpaw.http import HttpRequest, HttpResponse, HttpHeaders
from xpaw.utils import get_params_in_url
    assert new_req.method == 'POST'


def test_http_request_to_dict():
    headers = HttpHeaders()
    headers.add('Set-Cookie', 'a=b')
    headers.add('Set-Cookie', 'c=d')
    req = HttpRequest('http://example.com/', 'POST', body=b'body', headers=headers)
    d = req.to_dict()
    assert d['url'] == 'http://example.com/'
    assert d['method'] == 'POST'
    assert d['body'] == b'body'
    assert d['headers'] == headers

    req2 = HttpRequest.from_dict(d)
    assert req.url == req2.url
    assert req.method == req2.method
    assert req.body == req2.body
    assert req.headers == req2.headers


def test_copy_http_response():
    resp = HttpResponse('http://example.com/', 200, body=b'body')
    copy_resp = resp.copy()
    assert copy_resp.url == 'http://example.com/'
    assert copy_resp.status == 200
    assert copy_resp.body == b'body'


def test_replace_http_response():

# Path: xpaw/http.py
# class HttpRequest:
# class HttpResponse:
#     def __init__(self, url, method="GET", body=None, params=None, headers=None, proxy=None,
#                  timeout=20, verify_ssl=False, allow_redirects=True, auth=None, proxy_auth=None,
#                  priority=None, dont_filter=False, callback=None, errback=None, meta=None,
#                  render=None):
#     def __str__(self):
#     def meta(self):
#     def copy(self):
#     def replace(self, **kwargs):
#     def to_dict(self):
#     def from_dict(cls, d):
#     def __init__(self, url, status, body=None, headers=None,
#                  request=None, encoding=None):
#     def __str__(self):
#     def encoding(self):
#     def encoding(self, value):
#     def text(self):
#     def meta(self):
#     def copy(self):
#     def replace(self, **kwargs):
# 
# Path: xpaw/utils.py
# def get_params_in_url(url):
#     return parse_qs(urlsplit(url).query)


# Path: tests/test_http.py
from xpaw.http import HttpRequest, HttpResponse, HttpHeaders
from xpaw.utils import get_params_in_url

    assert new_req.method == 'POST'


def test_http_request_to_dict():
    headers = HttpHeaders()
    headers.add('Set-Cookie', 'a=b')
    headers.add('Set-Cookie', 'c=d')
    req = HttpRequest('http://example.com/', 'POST', body=b'body', headers=headers)
    d = req.to_dict()
    assert d['url'] == 'http://example.com/'
    assert d['method'] == 'POST'
    assert d['body'] == b'body'
    assert d['headers'] == headers

    req2 = HttpRequest.from_dict(d)
    assert req.url == req2.url
    assert req.method == req2.method
    assert req.body == req2.body
    assert req.headers == req2.headers


def test_copy_http_response():
    resp = HttpResponse('http://example.com/', 200, body=b'body')
    copy_resp = resp.copy()
    assert copy_resp.url == 'http://example.com/'
    assert copy_resp.status == 200
    assert copy_resp.body == b'body'


def test_replace_http_response():

    resp = HttpResponse('http://example.com/', 200, body=b'body1')