fix uploading non string values
This commit is contained in:
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));
|
||||||
|
Reference in New Issue
Block a user