Comments (5)
For reference, this is what I see when interacting with the endpoint through the (API
{
"error": {
"status": 404,
"message": "Player command failed: No active device found",
"reason": "NO_ACTIVE_DEVICE"
}
}
The Response
object from reqwest
, however, does not seem to provide any access to that json object. It would seem I am potentially missing something obvious, but I don't know what.
Response {
url: "https://api.spotify.com/v1/me/player/play?device_id=4a205e1455078ac27724255dd891265738f17dfe",
status: 404,
headers: {
"content-type": "application/json; charset=utf-8",
"cache-control": "private, max-age=0",
"access-control-allow-origin": "*",
"access-control-allow-headers":"Accept, App-Platform, Authorization, Content-Type, Origin, Retry-After, Spotify-App-Version",
"access-control-allow-methods": "GET, POST, OPTIONS, PUT, DELETE, PATCH",
"access-control-allow-credentials": "true",
"access-control-max-age": "604800",
"transfer-encoding": "chunked",
"date": "Sat, 09 Nov 2019 13:41:32 GMT",
"via": "1.1 google",
"alt-svc": "clear"
}
}
from rspotify.
Do you mean that the reqwest
will hide the error
message from the response, could you help me reproduce this case by doing it step by step?
from rspotify.
I am only guessing here, but I think that @sputnick1124 tried to print the reqwest
's Response
with something like:
println!("{:#?}", response);
Unfortunately, the implementation of the Debug
trait for Response
does not show the body of the response, only the URL, status and headers (see the implementation here). It leads @sputnick1124 to believe that the JSON returned by Spotify is not in the Response
. But it is. You can get the body with the .text()
, .bytes()
or even .json()
methods.
from rspotify.
@TimotheeGerber is correct. I was naively just printing out the Response
object and neglected to go look at it's implementation. I have a clear idea now of what I am trying to do. I'll work on a PR and get that up sometime this week.
Thanks, @TimotheeGerber!
from rspotify.
PR is open. Please provide any comments/suggestions for improvement.
from rspotify.
Related Issues (20)
- Release a new version HOT 2
- Incorrect type for playlist position HOT 3
- PlaylistItem.track possibly shouldn't be wrapped in Option HOT 2
- Automatically request token on startup HOT 4
- ClientCredsSpotify doesn't re-authenticate HOT 6
- Uri enum HOT 4
- convenience method to turn Page + Client into a Stream HOT 2
- Client method to sync playlist content efficiently using multible api calls. HOT 2
- Auth code flow, redirect server. HOT 2
- 0.11.17 breaks PKCE auth HOT 1
- `tracks_features` breaks on deserialization when a track is requested that doesn't have audio features HOT 1
- Missing market field on the album API call HOT 1
- Yank version 0.11.7 from crates.io HOT 3
- Is Add Custom Playlist Cover Image request implemented ? HOT 2
- json parse error: unknown variant `Smartwatch`
- Route `/v1/shows/{id}` requires market query parameter but `get_a_show` market parameter is `Option` HOT 2
- queryArtistOverview / artist stats (monthly listeners) HOT 2
- AuthCodeSpotify with token and refresh HOT 2
- Incorrect url in OAuthClient documentation HOT 1
- json parse error when calling `artist` method HOT 24
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rspotify.