Olá, colegas. Estou no curso de React Native, e na parte de consumir os dados do servidor eu não consigo conectar de forma alguma. ja usei os 3 links disponibilizados e mesmo assim fica dando erro.
fetch('http://localhost:8080/api/public/fotos/rafael')
fetch('http://10.0.2.2:8080/api/public/fotos/rafael')
fetch('https://instalura-api.herokuapp.com/api/public/fotos/rafael')
Com esses links da o seguinte erro:
YellowBox.js:67 Possible Unhandled Promise Rejection (id: 0):
TypeError: Network request failed
TypeError: Network request failed
at XMLHttpRequest.xhr.onerror (blob:http://localhost:8081/6fc2c742-8a60-43c4-8d67-2ee96132b5b6:42527:18)
at XMLHttpRequest.dispatchEvent (blob:http://localhost:8081/6fc2c742-8a60-43c4-8d67-2ee96132b5b6:47969:27)
at XMLHttpRequest.setReadyState (blob:http://localhost:8081/6fc2c742-8a60-43c4-8d67-2ee96132b5b6:46830:20)
at XMLHttpRequest.__didCompleteResponse (blob:http://localhost:8081/6fc2c742-8a60-43c4-8d67-2ee96132b5b6:46657:16)
at blob:http://localhost:8081/6fc2c742-8a60-43c4-8d67-2ee96132b5b6:46767:47
at RCTDeviceEventEmitter.emit (blob:http://localhost:8081/6fc2c742-8a60-43c4-8d67-2ee96132b5b6:16846:37)
at MessageQueue.__callFunction (blob:http://localhost:8081/6fc2c742-8a60-43c4-8d67-2ee96132b5b6:16459:44)
at blob:http://localhost:8081/6fc2c742-8a60-43c4-8d67-2ee96132b5b6:16216:17
at MessageQueue.__guard (blob:http://localhost:8081/6fc2c742-8a60-43c4-8d67-2ee96132b5b6:16413:13)
at MessageQueue.callFunctionReturnFlushedQueue (blob:http://localhost:8081/6fc2c742-8a60-43c4-8d67-2ee96132b5b6:16215:14)
Eu ja instalei o mySQL server e exeutei o comando java -jar instalura.jar, o banco rodou mas quando faço a requisição ele joga o seguinte erro.
Error parsing HTTP request header
Note: further occurrences of HTTP header parsing errors will be logged at DEBUG level.
java.lang.IllegalArgumentException: Invalid character found in method name. HTTP method names must be tokens
at org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:462) ~[tomcat-embed-core-8.5.5.jar!/:8.5.5]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:667) ~[tomcat-embed-core-8.5.5.jar!/:8.5.5]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [na:1.8.0_171]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [na:1.8.0_171]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-embed-core-8.5.5.jar!/:8.5.5]
at java.lang.Thread.run(Thread.java:748) [na:1.8.0_171]
Eu não sei mais o que fazer.