How to If-Modified-Since with Azure functions?

Emil Alipiev 276 Reputation points
2020-12-05T04:01:04+00:00

I am creating azure functions based on my previous .net core api. Basically i was returning 304 not modified if request header has If-Modified-Since tag and my data hasnt changed since.
Using Api simply i can get
var requestHeaders = Request.GetTypedHeaders();
requestHeaders.IfModifiedSince

Can I do this in Azure functions?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,605 questions
0 comments No comments
{count} votes

Accepted answer
  1. Pramod Valavala 20,611 Reputation points Microsoft Employee
    2020-12-07T06:24:07.953+00:00

    There is a HttpRequest.Headers Property that returns a dictionary of the header values which you can use to get the value of a specific header by key.

    In your case, something like req.Headers["If-Modified-Since"].ToString() should return the value of header as a string if present, or an empty string if not.

    1 person found this answer helpful.
    0 comments No comments

0 additional answers

Sort by: Most helpful