Der Inhaltstyp „application/octet-stream“ wird nicht unterstütztJava

Java-Forum
Anonymous
 Der Inhaltstyp „application/octet-stream“ wird nicht unterstützt

Post by Anonymous »

Rest-API-Methode

Code: Select all

@PostMapping(value = "/test", produces = {MediaType.APPLICATION_JSON_VALUE}, consumes = {MediaType.MULTIPART_FORM_DATA_VALUE})
@ResponseStatus(HttpStatus.CREATED)
ResponseEntity createAsset(
@Valid @RequestPart("requestBody") MyClass jsonPart,
@Valid @NotNull @RequestPart("file") MultipartFile file);
Fehlerkonsole

Code: Select all

2023-07-12 10:59:48.128 WARN  [http-nio-8080-exec-4] o.s.w.s.m.s.DefaultHandlerExceptionResolver - Resolved [org.springframework.web.HttpMediaTypeNotSupportedException: Content type 'application/octet-stream' not supported]
Swagger-Ergebnis

Code: Select all

{
"timestamp": "2023-07-12T08:59:48.135+00:00",
"status": 415,
"error": "Unsupported Media Type",
"path": "/v1/test"
}
löst einen 415-Fehler aus, wenn ich versuche, diese Methode auszuführen

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post