Modify /image POST endpoint to read from the POST body.

This commit is contained in:
Joshua Sigona 2020-07-21 06:13:15 +09:00
parent 0a9b5a44ba
commit 1c48e04829

View File

@ -12,6 +12,7 @@ import org.springframework.boot.web.servlet.FilterRegistrationBean;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.filter.CharacterEncodingFilter; import org.springframework.web.filter.CharacterEncodingFilter;
@ -67,7 +68,7 @@ public class Controller {
} }
@PostMapping("/image") @PostMapping("/image")
public String postImage(@RequestParam Map<String,String> body){ public String postImage(@RequestBody Map<String,String> body){
HashMap<String,String> data = new HashMap<>(); HashMap<String,String> data = new HashMap<>();
if (body.containsKey("url") && body.containsKey("user") && body.containsKey("auth")) { if (body.containsKey("url") && body.containsKey("user") && body.containsKey("auth")) {
HashMap<String,String> imageData = GetImageData(body.get("url")); HashMap<String,String> imageData = GetImageData(body.get("url"));