How to pass "If-Modified-Since" in an HTTP request?

I get a collection of books from an external resource. For this, I use a call like

response = book_resource.get_books({headers:{"If-Modified-Since" => last-update-date.httpdate}}) 

In the last update date, I saved the value of the last change from the header of the previous response. But I always get the status code as 200, but instead of 304 it is not changed. But when I tried to use etag using the following code.

  response = book_resource.get_books({headers:{"If-None-Match" => "etag"}}) 

The above works fine and does not return 304. Please help me what I am missing with modified from

+4
source share
1 answer

What tool do you use to send an HTTP request? Check out the docs to learn how to send a custom header. For example, here is how to add headers in httprb.

0
source

Source: https://habr.com/ru/post/1490486/


All Articles