You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the server receives a valid OCPI object it SHOULD respond with:
• HTTP 200 - Ok when the object already existed and has successfully been updated.
• HTTP 201 - Created when the object has been newly created in the server system.
But the HTTP code is generated based on the OCPI status, so it's difficult to know which HTTP status must be returned.
I agress with you, there is a design issue here (#11 is also caused by this design issue). The real issue is that we do not have any context here.
In #11, we need something to say that even if we do not have any data, it should be HttpStatus.OK, and in your case, even if it's SUCCESS and there is some data, it has to be 201.
We need a way to pass the HttpStatus if we need something specific. And otherwise, we should use the existing logic. I am unsure what approach to use
In that case, we will need to update a lot of code.
Otherwise, one way to do that would be to use coroutine context, and pass HttpStatus if we want to override it. We will add support for adding stuff in a coroutine context soon
The OCPI documentation states that:
But the HTTP code is generated based on the OCPI status, so it's difficult to know which HTTP status must be returned.
ocpi-toolkit/ocpi-toolkit-2.2.1/src/main/kotlin/com/izivia/ocpi/toolkit/common/OcpiResponseBody.kt
Line 124 in ed450b6
The text was updated successfully, but these errors were encountered: