Skip to content

Etag extraction from header incomplete? #169

@Pfeil

Description

@Pfeil

Describe the bug

The method ControllerUtils::getEtagFromHeader is supposed to extract the Etag, but it only checks the If-Match
header, which makes it interesting for updating resources only.

String etagValue = request.getHeader("If-Match");

According to this article, another header may be relevant in other cases, although spring usually handles this for us.

Using an If-* header turns a standard GET request into a conditional GET. The two If-* headers that are using with ETags are “If-None-Match” and “If-Match” – each with its own semantics as discussed later in this article.

The linked RFC in the article is an outdated draft, the current version is here. Both mention the "*" wildcard, and supporting a list of etags. Not sure but I think we do not support this (in this manual check, at least. Spring probably does.)

To Reproduce

Nothing to reproduce. I found it while checking available utilities.

Expected behavior

  • The documentation should make clear that this function is only appropriate for update cases / the if-match header.
  • There could be a function handling multiple values and wildcard ("*"). This function may be used for different check functions, like the ones already provided.

Screenshots

None. Check out the links to the source code and the article above.

Desktop (please complete the following information):

Independent. Just talking about the source code here.

Additional context

none

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions