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

How to specify request headers? #1734

Closed
mlagally opened this issue Oct 24, 2022 · 5 comments
Closed

How to specify request headers? #1734

mlagally opened this issue Oct 24, 2022 · 5 comments
Labels
Propose closing Problem will be closed shortly if there is no veto. question

Comments

@mlagally
Copy link
Contributor

There's a normative requirement to specify request headers as part of a form.

Every form in a WoT Thing Description MUST accurately describe requests (including request headers, if present) accepted by the Thing in an interaction.

How can that be done?

@github-actions github-actions bot added the needs-triage Automatically added to new issues. TF should triage them with proper labels label Oct 24, 2022
@egekorkan egekorkan removed the needs-triage Automatically added to new issues. TF should triage them with proper labels label Oct 24, 2022
@egekorkan
Copy link
Contributor

egekorkan commented Oct 24, 2022

This is actually an important question and further examples can help clarifying this.

So this done via the Protocol Bindings with HTTP being available in the TD spec. For example, htv:methodName can be used to indicate the method to be used in HTTP. Method Name is a request header but there are of course other headers.

As explained in https://w3c.github.io/wot-thing-description/#http-binding-assertions , one solution is to use the HTTP in RDF at https://www.w3.org/TR/HTTP-in-RDF10/ to describe such request headers.

In a TD form, you can have:

"htv:headers":
[
    {
    "htv:fieldName": "Accept",
    "htv:fieldValue": "application/json"
    },

Which means that the Consumer needs to supply an Accept header with value of "application/json" in the request.

In case you are looking for a more generally-applicable answer, I would say that this would be done via context extensions. Please see https://w3c.github.io/wot-thing-description/#sec-context-extensions for more information about this mechanism of the TD (of JSON-LD to be specific).

Note: This assertion was in the 1.0 version as well. Please see https://www.w3.org/TR/wot-thing-description/#protocol-bindings

@mlagally
Copy link
Contributor Author

@egekorkan
Thanks very much for this explanation, which brings a lot of clarity.
2 questions remain:

  • the prefix in the TD spec is htv: whereas in the RDF document it is http: Why?
  • the type headers is not in the RDF spec- which headers type do we mean?

@egekorkan
Copy link
Contributor

My pleasure in answering them. For the further questions:

@sebastiankb sebastiankb added Propose closing Problem will be closed shortly if there is no veto. and removed by CR transition labels Nov 16, 2022
@sebastiankb
Copy link
Contributor

from today's TD call, the group like to close this issue

@mlagally please check if this is ok for you

@egekorkan
Copy link
Contributor

Call of 05.04:

  • This was a question, not a bug of the spec. Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Propose closing Problem will be closed shortly if there is no veto. question
Projects
None yet
Development

No branches or pull requests

3 participants