Comments (6)
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.
@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.
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.
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.
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.
I am closing this ticket as my question has been answered.
Thanks.
from runtime.
Related Issues (20)
- Authorization token HOT 1
- Swagger Middleware drops trailing slash and can't find path HOT 3
- Give ClientResponseReaderFunc access to the request?
- Add a public BuildHTTP method HOT 1
- debugLog func must use Logger.Debugf
- Upgrade to YAMLv3 HOT 2
- Unable to set a parameter of type file as optional HOT 3
- Long term plans for current OpenTracing implementation? HOT 5
- No consumer for application/pdf in the Runtime class HOT 1
- the value of request.ContentLength remains 0 on HTTP POST with body HOT 1
- API UI middleware oAuth2 callback not working
- Extract middleware with UI to separate repository HOT 1
- How to get the client response? HOT 5
- CSVProducer returns error 'data type must be byte array'
- Client can not upload empty file HOT 1
- Panic on [email protected]/request.go:99 HOT 1
- Support file upload with application/x-www-form-urlencoded
- Incompatible minimum golang version declared in go.mod HOT 1
- Allow for a spec list in SwaggerUIOpts
- How to disable `try it out` option for the swagger-ui HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from runtime.