Hi guys, I need your help. I use wiremock with Doc...
# help
m
Hi guys, I need your help. I use wiremock with Docker, I need make a HTTP request since Flutter, but I cant get the reponse
o
Hi! Could you please provide WireMock configuration? Right now I do not see how stubs are configured
You can also run it in --verbose mode to get runtime information about incoming requests
a
Hey Mario! You have two problems: 1. Dart related: you’re building your Uri wrong. It should be
Uri.https('localhost:8080/2/tweets/search/stream/rules')
2. Once you build your URI correctly you will “hit a wall” cause you’re building an http*s* call without configuring https on your Wiremock instance so you either switch to Uri.http instead or configure Wiremock’s https
m
Hi @Alejandro Lorefice I try use http (photo) but the error is the same, about the other option, maybe I need the certificate server.crt of Wiremock for able use this option or I mistake?
a
In the screenshot you’ve shared you’re still using https 🤔 And in case you intentionally want to use https, you would only need to configure certificates if you expect/want to test certificates as far as I know. Otherwise it’s just fine to enable the https port and make your request to it.
m
Do you can help me @Alejandro Lorefice? How should be the code for not use certificate and use http? I'm confuse, I searched for all sides and still not meet response
a
Si querés testear una ruta que sirve HTTP, solo necesitás reemplazar
Uri.https
por
Uri.http
Si querés testear una ruta que sirve HTTPS, tenés que agregar el https-port y apuntar tu request a ese puerto (reemplazar el 8080 en tu llamada por el puerto que le asignes a https). No te puedo decir como hacerlo porque no sé cómo estás corriendo el wiremock Y aún así puede que te falle por los certificados, ahí no te puedo ayudar tanto porque nunca configuré los certificados para testear endpoints https. Es cuestión de probar todas las alternativas que da la docu
❤️ 1
m
Encontre la solucion, tiene que ver con el uso de cors, dejo el link por si alguien mas lee esto https://stackoverflow.com/questions/42422343/wiremock-cors-not-working