I have a request that is part of an OAUTH login process. Possible results are:
200 - a message of some kind - (I have not seen what, yet).
302 - redirect to Authorize page
302 - redirect to Not Authorized page
302 - redirect to Application main page
The redirect to Not Authorized page is a problem, and the .check() should fail in that case.
How can I compose a .check() that, if header(“Location”) is found, it must not match some pattern, or contain some substring?
I thought it would be something like this:
`
.check( header(“Location”).transformOption( _ match {
case None => Some(true)
case Some(s) => if ( s.contains("/security/not-eligible") ) Some(false) else Some(true)
}).is( true )
`
But I get a compile error:
missing parameter type for expanded function
The argument types of an anonymous function must be fully known. (SLS 8.5)
I’ve tried several other syntactic structures, but no luck so far. What is the right way of doing this?
The closest thing to discussing this subject I can find is where you pointed out that if you don’t disableFollowRedirect, then you will never see the header. That’s not my problem. I’m struggling to get it to compile.
But while it compiles, it doesn’t function correctly. I need it to pass the check if the Location header is not present, and fail if it exists and contains the string, otherwise, pass.