Recently i had a problem that some cookies were coming from the server with the attribute domain being null, i.e:
Set-Cookie: foo=bar;domain=;expires=Wed, 21 Oct 2021 07:28:00 GMT;
This results in an exception being thrown, saying that the domain of a cookie is null.
I could completely ignore the cookies, however, i really need this cookie to proceed to the next request, the server is expecting him, and if he's not on the next request, i wont be able to proceed.
So, I've decided to edit the server response, and add the domain to be equal the host of the request!
I've tried adding clj-http custom middlewares but no success. I'm using cookie-store's for cookies handling, and he didn't updated with the edited cookies.
And everything is working as expected! This is not exactly an issue with clj-http, however someone else might ran into a similar problem, and i wanted to know opinions about my solution, if there's something more simple than what i did, would be awesome to know.
Recently i had a problem that some cookies were coming from the server with the attribute domain being null, i.e:
Set-Cookie: foo=bar;domain=;expires=Wed, 21 Oct 2021 07:28:00 GMT;
This results in an exception being thrown, saying that the domain of a cookie is null. I could completely ignore the cookies, however, i really need this cookie to proceed to the next request, the server is expecting him, and if he's not on the next request, i wont be able to proceed.
So, I've decided to edit the server response, and add the domain to be equal the host of the request!
I've tried adding clj-http custom middlewares but no success. I'm using cookie-store's for cookies handling, and he didn't updated with the edited cookies.
After thinking that the problem might be the order that my middleware was being called, i thought adding the response editing directly on apache, using this https://github.com/dakrone/clj-http#modifying-apache-specific-features-of-the-httpclientbuilder-and-httpasyncclientbuilder
And at the end i came up with:
Then i do requests this way
And everything is working as expected! This is not exactly an issue with clj-http, however someone else might ran into a similar problem, and i wanted to know opinions about my solution, if there's something more simple than what i did, would be awesome to know.