1

I try to write some regression tests for my web application with Groovy and http-builder-ng.
To check all the headers for every request I would like to turn off the auto redirection. To do this with http-builder there are BasicHttpParams, but I think BasicHttpParams are not working with http-builder-ng.
Is there another way to turn off auto redirection?

Vampire
  • 35,631
  • 4
  • 76
  • 102
daskai0815
  • 175
  • 1
  • 2
  • 7

1 Answers1

4

I didn't use http-builder-ng before, but from the docs I don't see a way to configure this directly. But you use some variant with client implementation, by default core, apache or okhttp. I guess you need to configure the underlying client library you are using to not follow redirects using clientCustomizer as described at https://http-builder-ng.github.io/http-builder-ng/asciidoc/html5/#_client.

E. g. with the core variant:

http = configure {
    request.uri = 'test.com'
    client.clientCustomizer { it.followRedirects = false }
}
Vampire
  • 35,631
  • 4
  • 76
  • 102