-
Firstly, thanks for your work on this. I need to accept text/plain and text/html request bodies i.e. not JSON/XML. I can achieve this using the type DocumentInput struct {
Tenancy string `path:"tenancy"`
Content string
}
func (input *DocumentInput) SetRequest(r *http.Request) {
b, _ := ioutil.ReadAll(r.Body)
r.Body.Close()
input.Content = string(b)
} However the generated swagger docs are not aware of the plain text payload: {
"/{tenancy}/documents/": {
"post": {
"parameters": [
{
"name": "tenancy",
"in": "path",
"required": true,
"schema": {
"type": "string"
}
}
]
}
}
} Is there any way I can tell the Interactor that the request body should be a text payload? Thanks |
Beta Was this translation helpful? Give feedback.
Answered by
vearutop
Apr 12, 2023
Replies: 1 comment
-
Hello, in such case, you can use handler annotation when adding your use case to router/web service. Please check an example. s.Post("/{tenancy}/documents/", textReqBody(), nethttp.RequestBodyContent("text/plain")) |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
thobson
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, in such case, you can use handler annotation when adding your use case to router/web service.
Please check an example.