2

i'm trying to do a request with FeignClient in my Spring-Boot app to https://pixabay.com/api?key=17079440-d2facf535011df5d60e5ccfe2&q=Playstation%203&image_type=photo but but this exception has been throw:

2020-06-17 21:10:24.730 ERROR 14008 --- [nio-8080-exec-1] o.a.c.c.C.[.[.[/].[dispatcherServlet]    : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is feign.FeignException: [301 Moved Permanently] during [GET] to [https://pixabay.com/api?key=17079440-d2facf535011df5d60e5ccfe2&q=Playstation%203&image_type=photo] [PixabayClient#getImageUrl(String,String,String)] 

https://pastebin.com/yeNbcP5k

I already tried to make a request through the postman and the browser, and the response was returned normally :(

Here is my FeignClient class: https://pastebin.com/MFhFs5um

And there is my pom.xml: https://pastebin.com/4XXjYkyE

Rodrigo Lima
  • 29
  • 1
  • 3
  • Could this be a problem caused by the `http -> https` redirect? – fatih Jan 28 '21 at 21:58
  • Your relevant code, such as your FeignClient class, needs to be here in the question, not only in a pastebin. Using a pastebin is ok to _supplement_, but all the information needed to answer should be part of the question itself. – Stephen P Jan 28 '21 at 22:03

2 Answers2

1

Probably this is something your application can resolve.

What your browser does is to automatically follow the redirect and execute another request to the URL given in the redirection response. Now you could catch the exception, take the URL and run another request just like the browser does.

Queeg
  • 7,748
  • 1
  • 16
  • 42
1

This often happens when you confuse HTTP and HTTPS in your request.

Emmanuel H
  • 82
  • 8