geting "Request URI too long" (414) with MockMvc

By Martin Brišiak

i’m trying to create a unit test for my spring rest service. Everything works but i’m unable to finish my unit tests (i know that unit tests should be written first :( ). Using MockMvc (org.springframework.test.web.servlet.MockMvc) I’m getting 414 instead of a expected 200. I’m sending a picture encoded as base64 string in body to sample url: /endpoint/something/hexnumber/category/1/Image/string.

Any chance that i can setup max reqest length for MockMvc?

sample code:

@Autowired private MockMvc mvc
public void shouldSendImage() throws Exception{
    String image = "/9j/4AAQSkZJRgABAQEA.......";
                    .content("""+image +"""))

PS: it’s just a sample code.

Source: Stack Overflow


Share it with your friends!

    Fatal error: Uncaught Exception: 12: REST API is deprecated for versions v2.1 and higher (12) thrown in /home/content/19/9652219/html/wp-content/plugins/seo-facebook-comments/facebook/base_facebook.php on line 1273