fix uploading non string values
Some checks failed
Deploy App / docker (ubuntu-latest, 2.44.0, 17, 3.8.5) (push) Failing after 28s
Publish Docker Image / docker (ubuntu-latest) (push) Successful in 36s

This commit is contained in:
Lee 2024-04-24 19:06:00 +01:00
parent 38848349fd
commit 4c95983c47

@ -3,6 +3,7 @@ package cc.fascinated.backend.controller;
import cc.fascinated.backend.model.Paste; import cc.fascinated.backend.model.Paste;
import cc.fascinated.backend.service.PasteService; import cc.fascinated.backend.service.PasteService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -26,7 +27,7 @@ public class PasteController {
)); ));
} }
@PostMapping(value = "/upload") @PostMapping(value = "/upload", consumes = MediaType.TEXT_PLAIN_VALUE)
public ResponseEntity<?> uploadPaste(@RequestBody String content) { public ResponseEntity<?> uploadPaste(@RequestBody String content) {
String id = pasteService.createPaste(content); String id = pasteService.createPaste(content);
return ResponseEntity.ok(Map.of("id", id)); return ResponseEntity.ok(Map.of("id", id));