GithubHelp home page GithubHelp logo

Comments (6)

casualjim avatar casualjim commented on June 26, 2024

At the time I assumed that all the headers would be in the swagger specification, but that's just for the generated code. I may not fully understand your question because from what I see the response reader is responsible for parsing the headers out.

As far as I can tell we don't do anything special with the http headers, the response struct just wraps the http.Response object:

https://github.com/go-openapi/runtime/blob/master/client/response.go#L38-L40

The response reader is one you'd provide yourself if you're using the untyped API: https://github.com/go-openapi/runtime/blob/master/client_response.go#L41-L43

from runtime.

elakito avatar elakito commented on June 26, 2024

@casualjim What I mean is that the client.response wraps http.Response and exposes its GetHeader(string). So if you know the header name, you can read its value. But there is no method exposed to read all header entries, one cannot read unknown headers from the response.

from runtime.

casualjim avatar casualjim commented on June 26, 2024

if you expect a particular header to exist, shouldn't it really be a part of the swagger definition? Especially for client operations?

from runtime.

elakito avatar elakito commented on June 26, 2024

I was wondering if the server returns some additional headers that are not defined in the application level swagger definition, if there is a way to read those headers as part of some middleware handling to react to those headers. But since this middleware handling code that are supposed to react to some specific headers must have known those headers, it could lookup these headers using their names.

Unless this middleware processing looks for headers generically like get all headers that start with some prefix, there is no need to have the API to return all headers. That was why I asked about the background behind this API and also wondered if someone had such need or not. My question has been answered and we can close this ticket.

regards, aki

from runtime.

casualjim avatar casualjim commented on June 26, 2024

Yeah I guess there might be a case for it, but it still implies implicit knowledge of your system right?
There might be a case for it when you aren't in control of the API you're calling though.

from runtime.

elakito avatar elakito commented on June 26, 2024

I am closing this ticket as my question has been answered.
Thanks.

from runtime.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.