-
Notifications
You must be signed in to change notification settings - Fork 445
Closed
Description
Tapir version: 1.11.33
Scala version: 3.7.0
Describe the bug
Every time I am trying to access some of the tapir endpoints I get 400 with "Invalid value for: path parameter ?% " even though all the input data and endpoint definitions seem to be correct.
've tried debugging it with logs and it seems like the app doesn't even reach neither zServerSecuityLogic handler nor serverLogic, so apparenly it has something to do with how tapir parses these requests. Changing the input type to plainBody didn't help either, as well as changing the
Content-type" in the http request. I've also tried creating a simplified test endpoint like
val testEndpoint = securedEndpoint
.put
.in("test")
.in(plainBody[String])
.out(plainBody[String])
.zServerSecurityLogic(AuthHandlers.authenticateUser)
.serverLogic { userId => input =>
ZIO.logInfo(s"Test input: $input") *>
ZIO.succeed(s"Received: $input")
}
and the funny part is that it also give the same 400 error unless we change its type to GET:
val testEndpoint = securedEndpoint
.get
.in("test")
.in(plainBody[String])
.out(plainBody[String])
.zServerSecurityLogic(AuthHandlers.authenticateUser)
.serverLogic { userId => input =>
ZIO.logInfo(s"Test input: $input") *>
ZIO.succeed(s"Received: $input")
}
How to reproduce?
- Clone my project repo: https://github.com/TheBugYouCantFix/MovieListApp
- Create a db and set its name and password at src/main/scala/app/backend/data/DataSource.scala
- Run the project
- Open the swagger at http://localhost:8080/docs/#/
- Get a token from a /signup endpoint, authorize with it
- Try to make a call to /updateUsername or /updatePassword endpoints
Metadata
Metadata
Assignees
Labels
No labels