Download file #1504
Unanswered
m-mattia-m
asked this question in
Q&A
Download file
#1504
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Environment:
go version go1.19 darwin/arm64
swag version v1.8.10
I have created an API with Gin-Gonic where I can download a file. This file is transferred as a byte array. When I open the swagger, I get a success after executing the request and I can download the file. Now I have imported the Swagger doc file in the frontend and generated the API calls from it. But now when I send a request from the frontend I get a success in the network but when I download the file it is empty. Online I have seen that it can be because I have specified the wrong response type with Swaggo. Which response type is needed for a file download?
FileData
is in Go a[]byte
which comes from the S3. As mentioned, I can also download it correctly in Postman and the SwaggerUI.I would now claim the problem is due to my configuration in the backend, since I have defined a string as the response type. If the problem is in the frontend, here is my code. I am using Vue with TypeScript and the Pinia store.
Beta Was this translation helpful? Give feedback.
All reactions