Open
Description
Im having trouble uploading an image. My swagger definition is:
'/orders-logo':
post:
x-swagger-router-controller: OrdersController
tags:
- orders
summary: This API is upload a logo
operationId: uploadLogo
consumes:
- multipart/form-data
produces:
- application/json
parameters:
- name: file
in: formData
description: file to upload
required: false
type: file
responses:
'200':
description: Success
schema:
$ref: '#/definitions/TokenView'
'400':
description: The request doesn't comply with the schema specified
schema:
$ref: '#/definitions/ApiError'
'401':
description: Missing or invalid Authorization header
schema:
$ref: '#/definitions/ApiError'
'500':
description: Internal server error while processing the request
schema:
$ref: '#/definitions/ApiError'
And my method in the Controller:
public ResponseContext uploadLogo(RequestContext context, java.io.InputStream file) {
ResponseContext response = new ResponseContext().contentType(MediaType.APPLICATION_JSON_TYPE);
System.out.println("in here");
}
And I'm trying a few different CURLs:
curl -i -X POST \
-H "Content-Type: multipart/form-data" \
-H 'Authorization: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhbm9uXzU3MjBmMGUzLTMxMzItNDQ1OC1hYjYyLTBmY2EwMDEyMjAyNCIsImlzcyI6IkNsZXZlcmdpZnQiLCJleHAiOjE2MTY1MjEwMjMsImJhc2ljIjoidHJ1ZSIsIm1lcmNoYW50IjoiaGlnaHN0cmVldHZvdWNoZXJzIn0.s-yukQincZoWevQARLNrl57SABAetBxMCOF39RSd7a7tEnds5pIgo5ekRTQgX98MlEXFyDoHe0ws7iMIo_-cOQ' \
-H 'Api-Key: 7a34526370e2c3d4f2784f874aacbc0b' \
-F "[email protected]" "http://localhost:8080/v1/orders-logo"
and:
curl --location --request POST 'http://localhost:8080/v1/orders-logo' \
--header 'Api-Key: 7a34526370e2c3d4f2784f874aacbc0b' \
--header 'Content-Type: multipart/form-data' \
--header 'Authorization: eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJhbm9uXzU3MjBmMGUzLTMxMzItNDQ1OC1hYjYyLTBmY2EwMDEyMjAyNCIsImlzcyI6IkNsZXZlcmdpZnQiLCJleHAiOjE2MTY1MjEwMjMsImJhc2ljIjoidHJ1ZSIsIm1lcmNoYW50IjoiaGlnaHN0cmVldHZvdWNoZXJzIn0.s-yukQincZoWevQARLNrl57SABAetBxMCOF39RSd7a7tEnds5pIgo5ekRTQgX98MlEXFyDoHe0ws7iMIo_-cOQ' \
--form '=@"/Users/markkelly/Pictures/download.jpeg"'
But I get:
{"code":404,"message":"HTTP 404 Not Found"}
back from the server.
Im using swagger-inflector version 1.0.17. Any ideas what I am doing wrong?
Metadata
Metadata
Assignees
Labels
No labels