Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Initial attempt at making map_api_response accept non-json api responses #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

gabbifish
Copy link
Contributor

This PR explores a PoC for one part of #26. It focuses on allowing non-json response bodies to be accepted by cloudflare-rs and returned using the same ApiSuccess.result accessor pattern used by preexisting users of cloudflare-rs.

My questionable first approach to this problem: trying to shove the raw text API response into the ApiSuccess.result field, which should ensure that this change is not breaking, but also fails with

error[E0308]: mismatched types
  --> /home/gabbi/github/cloudflare-rs/src/response/mod.rs:39:33
   |
39 |                         result: body, 
   |                                 ^^^^ expected type parameter, found struct `std::string::String`
   |
   = note: expected type `ResultType`
              found type `std::string::String`

^ I'm not sure how to get around this (or if this approach even makes much sense in the first place). I floated other ideas in the comments in the code changes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant