-
Notifications
You must be signed in to change notification settings - Fork 147
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
Static list of consumers / producers? #31
Comments
There is a clear TODO in the runtime code, right above the location you linked (https://github.com/go-openapi/runtime/blob/master/client/runtime.go#L136), so I suppose that gives the answer you are seeking for. Another possible TODO will need or should to be solved is https://github.com/go-openapi/runtime/blob/master/client/runtime.go#L231 (this TODO/bug is about making the consumer selection smarter than simply selecting the first one available in the array) Solving those TODOs in a reasonable way will resolve your issue. Setting those runtime consumers producers for generated clients by go-swagger is already possible, by creating the runtime yourself (possibly using the generated client defaults), setting a consumer/producer for your custom MIME Type and pass that newly created runtime to the constructor of your generated API client. |
In fact you might already make your code work by simply adding your custom consumer/producer as follows: rt := runtime.New(myHost, myBasePath, mySchemes)
rt.Consumers["application/problem+json"] = runtime.JSONConsumer()
rt.Producers["application/problem+json"] = runtime.JSONProducer()
// do something with the newly created runtime
// .. |
It seems the cited code has been modified and the list of mimetimes is no longer there. Can you check if this is still an issue? |
Hello,
Trying to understand why my client (generated by go-swagger) would not accept the
application/problem+json
media type I stumbled upon these hard coded values: https://github.com/go-openapi/runtime/blob/master/client/runtime.go#L137-L147What are the reason for these?
They are used in
Submit()
but shouldn't the values from the passedruntime.ClientOperation
struct be used instead e.i.runtime.ClientOperation.ProducesMediaTypes
andruntime.ClientOperation.ConsumesMediaTypes
?The text was updated successfully, but these errors were encountered: