GithubHelp home page GithubHelp logo

Comments (6)

tomakehurst avatar tomakehurst commented on July 19, 2024

Could you give me some details on your basic auth setup?

I've got one outstanding issue open regarding 400 responses where auth headers are sent, so I'm curious that you seem to be having the opposite experience.

from wiremock.

MattVonVielen avatar MattVonVielen commented on July 19, 2024

Just figured out that wiremock is ignoring expectations on arbitrary headers; I can make the test fail by expecting the wrong Content-Type. However, when I do this:

withHeader("Authorization", equalTo("text/plain"))

(deliberately mixing up Content-Type and Authorization) the test still passes.

from wiremock.

tomakehurst avatar tomakehurst commented on July 19, 2024

Looks like you've found a bug.

The odd thing is that it looks like I set it up this way on purpose, but since I seem not to have written a unit test that justifies it, I'm going to modify the behaviour so that it won't match when if you expect a header that isn't present in the request.

I'll try and get a 1.32 release out tonight with this included.

from wiremock.

MattVonVielen avatar MattVonVielen commented on July 19, 2024

Can you please explicitly make sure (integration testing by hand with curl, maybe) that matching specifically on Authorization will pass/fail when the credentials do/don't match? Might want to check Cookie too.

The reason I bring this up is, from a semi-random sampling of different "known" headers, those are the two that don't seem to get checked properly - perhaps Jetty is swallowing them? I was able to verify that matching does work for Content-Type, Connection, and User-Agent at a minimum.

Thanks!

from wiremock.

tomakehurst avatar tomakehurst commented on July 19, 2024

I've just pushed the 1.32 release with a fix that prevents a stub match when a required header isn't present in the request (it usually takes a few hours to sync to maven central).

I've also added a new acceptance test: StubbingAcceptanceTest.canSupportBasicAuthorization. This seems to work as expected, although I've had other anecdotes of 400 responses when using basic auth. Perhaps you could review this test case and see if it satisfies the case you're interested in?

from wiremock.

MattVonVielen avatar MattVonVielen commented on July 19, 2024

Verified that I can now correctly expect Authorization header.

from wiremock.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.