Skip to content
New issue

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

IETF Date in If-Modified-Since header #32

Open
dcore94 opened this issue May 29, 2018 · 2 comments
Open

IETF Date in If-Modified-Since header #32

dcore94 opened this issue May 29, 2018 · 2 comments

Comments

@dcore94
Copy link

dcore94 commented May 29, 2018

I need to use the If-Modified-Since header in one of my APIs. The format requested is the IETF date format:

If-Modified-Since: Wed, 21 Oct 2015 07:28:00 GMT

as explained in [1].
Unfortunately this conflicts with the specification in [2] where it's stated that commas are separators for multi value parameters.
Is there any way out of this without having to join back the values manually?
M.
[1] https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/If-Modified-Since
[2] http://exquery.github.io/exquery/exquery-restxq-specification/restxq-1.0-specification.html#form-header-annotation

@ChristianGruen
Copy link
Member

Hi @adamretter, so you remember why the comma separation rule was added to the spec? Greetings!

@adamretter
Copy link
Member

adamretter commented May 30, 2018

@ChristianGruen I don't remember exactly why that rule was chosen, but I suspect it was to enable easier handling of some other headers which are actually lists.

@dcore94 I don't think this should cause you any problems in practice, as you could do something like this:

declare
  %rest:GET
  %rest:path("/widget/{$id}")
  %rest:header-param("If-Modified-Since", "{$modified-since-header}")
function local:widget($id as xs:int, $modified-since-header as xs:string*) {
  let $modified-since := string-join($modified-since-header, ",")
  return
    <if-modified-since>{$modified-since}</if-modified-since>
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants