Handle empty body for Delete method and have a valid Result object
See original GitHub issueFeature Request
Description
I try to do a request delete HTTP method in a coroutine. My api return an empty body for a delete but I would like to receive a com.github.kittinunf.result.Result
after a call of Request.awaitObjectResult()
.
I know I shouldn’t use this class request method because my body is empty so I can’t deserialize nothing but I use your Result
class to check if my request is a success or not. I can work around the problem by returning a Result<ByteArray, FuelError>
but for me it doesn’t make sense when you read it.
Proposed Solution
Maybe a new awaitResult
extension method for Request
that return a Result
and doesn’t take any serializer as a parameter.
Alternatives I’ve considered
Do nothing and use Result<ByteArray, FuelError>
Additional context
I may make a mistake or have missed something
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Is an entity body allowed for an HTTP DELETE request?
The DELETE method requests that the origin server delete the resource identified by the Request-URI. This method MAY be overridden by human ...
Read more >DELETE - HTTP - MDN Web Docs
The HTTP DELETE request method deletes the specified resource. Request has body, May. Successful response has body, May. Safe, No. Idempotent ...
Read more >How to send DELETE request using REST assured? - Tools QA
This post takes you through the HTTP delete request method. Further, we discuss how to use the delete method using Rest API and...
Read more >HTTP/1.1: Method Definitions
This method can be used for obtaining metainformation about the entity implied by the request without transferring the entity-body itself. This method is...
Read more >What is HTTP DELETE Request Method? - ReqBin
The HTTP DELETE method is used to delete a resource from the server. Unlike GET and HEAD requests, the DELETE requests may change...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
🤔 Can you provide some sort of “dummy” Deserializable? Like
Then, pass it into your
awaitObjectResult
?It is probably nice if we can provide
awaitObjectResult()
, but I feel it is too specific to this use-case.Oh 😮. It was so simple. Sorry about that. Thank you very much ! Yes, I also think it’s too specific. Besides, you just showed me that there’s no need to do too much.