Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Does Pact have some feature to make redirects? #1323

Closed
wedla opened this issue Mar 10, 2021 · 5 comments
Closed

Does Pact have some feature to make redirects? #1323

wedla opened this issue Mar 10, 2021 · 5 comments

Comments

@wedla
Copy link

wedla commented Mar 10, 2021

Hello all! I'm sorry if this were already answered, but I didn't find anything to help me.

I'm trying to do the following tests with two "different" endpoints:

  • one that ends without a trailing slash, for example: /invoice (POST)
  • another that ends with a trailing slash, like: /invoice/ (POST)

I'm receiving 307 from the server. Is there a way that pact can handle this http code, get the exact location that comes in the response header, and try to make the request again?

I noted that with get requests, I don't face this problem, but with post ones, the test fails because it was expecting another http code (such as 202, 400) but received 307 (temporary redirect) and doesn't try making the request again.

My code:

image

where:
caminhoTransmissaoMultiplaComBarra = /invoices/
verboRequisicao = POST
cabecalhoTransmissaoSemEscopo = a bearer token + headers with content-type being "application/json".

@wedla wedla changed the title Has Pact some feature to do redirects? Does Pact have some feature to do redirects? Mar 10, 2021
@wedla wedla changed the title Does Pact have some feature to do redirects? Does Pact have some feature to make redirects? Mar 10, 2021
@uglyog
Copy link
Member

uglyog commented Mar 13, 2021

Redirect handling was disabled due to #952

I think a system property would help to enable that.

@uglyog
Copy link
Member

uglyog commented Mar 13, 2021

4.1.18 released. You can set the system property pact.verifier.enableRedirectHandling=true to enable it.

@wedla
Copy link
Author

wedla commented Apr 8, 2021

Hi @uglyog, sorry for the late response, but there is a future date for publishing this version on maven repository? my project is a maven one and i verified that this version is not there yet.

@uglyog
Copy link
Member

uglyog commented Apr 8, 2021

It is definitely there: https://repo1.maven.org/maven2/au/com/dius/pact/consumer/junit/4.1.18/ in fact 4.1.19 is now the latest version

@wedla
Copy link
Author

wedla commented Apr 28, 2021

Hi, @uglyog, this isse can be closed. I verified it and it works smoothly! Thank you very much!

@uglyog uglyog closed this as completed May 9, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants