question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Handle empty body for Delete method and have a valid Result object

See original GitHub issue

Feature 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:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
kittinunfcommented, Oct 8, 2019

🤔 Can you provide some sort of “dummy” Deserializable? Like

object UnitDeserializable : Deserializable<Unit> {
    fun deserialize(response: Response) = Unit
}

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.

0reactions
baillyjamycommented, Oct 9, 2019

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.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found