http: add optional future outputs for requests#187
Merged
Erk- merged 1 commit intotwilight-rs:masterfrom Jun 5, 2020
spring4175:http-request-optional-future-outputs
Merged
http: add optional future outputs for requests#187Erk- merged 1 commit intotwilight-rs:masterfrom spring4175:http-request-optional-future-outputs
Erk- merged 1 commit intotwilight-rs:masterfrom
spring4175:http-request-optional-future-outputs
Conversation
When the user uses a retrieval request, like getting a user by ID, the
future output is a `Result<Option<T>>`. The code to handle 404 response
status codes didn't actually exist, so it'd always either be
`Ok(Some(T))` or `Err(E)`.
This patch adds support for handling 404 responses and returning
`Ok(None)` where encountered on select retrieval routes.
Here's an example of output:
```
Getting guild member for user 1
Ok(None)
Getting guild member for user 640434332485287936
Ok(Some(Member { deaf: false, guild_id: None, hoisted_role: Non.....
```
Closes #157.
Signed-off-by: Vivian Hellyer <vivian@hellyer.dev>
AEnterprise
approved these changes
Jun 5, 2020
Member
AEnterprise
left a comment
There was a problem hiding this comment.
Looks good and works fine. huge simplification on the bot side to work with
Erk-
approved these changes
Jun 5, 2020
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When the user uses a retrieval request, like getting a user by ID, the future output is a
Result<Option<T>>. The code to handle 404 response status codes didn't actually exist, so it'd always either beOk(Some(T))orErr(E).This patch adds support for handling 404 responses and returning
Ok(None)where encountered on select retrieval routes.Here's an example of output:
Closes #157.