We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
https://httpretty.readthedocs.io/en/latest/introduction.html#link-headers
Does not work. It only registers the latest httpretty.register_uri !
httpretty.register_uri
import requests from sure import expect import httpretty @httpretty.activate def test_link_response(): first_url = "http://foo-api.com/data" second_url = "http://foo-api.com/data?page=2" link_str = "<%s>; rel='next'" % second_url httpretty.register_uri( httpretty.GET, first_url, body='{"success": true}', status=200, content_type="text/json", adding_headers={"Link": link_str}, ) httpretty.register_uri( httpretty.GET, second_url, body='{"success": false}', status=500, content_type="text/json", ) # Performs a request to `first_url` followed by some testing response = requests.get(first_url) expect(response.json()).to.equal({"success": True}) expect(response.status_code).to.equal(200) next_url = response.links["next"]["url"] expect(next_url).to.equal(second_url) # Follow the next URL and perform some testing. response2 = requests.get(next_url) expect(response2.json()).to.equal({"success": False}) expect(response2.status_code).to.equal(500)
The text was updated successfully, but these errors were encountered:
No branches or pull requests
https://httpretty.readthedocs.io/en/latest/introduction.html#link-headers
Does not work. It only registers the latest
httpretty.register_uri
!The text was updated successfully, but these errors were encountered: