You'll probably want to use one of the convenience methods instead.
public send ( string $method, string $url, array $parameters = [], array $headers = [] ) : array | ||
$method | string | The HTTP method to use. |
$url | string | The URL to request. |
$parameters | array | Optional. Query parameters. |
$headers | array | Optional. HTTP headers. |
리턴 | array | Response data. - array|object body The response body. Type is controlled by Request::setReturnAssoc(). - array headers Response headers. - int status HTTP status code. - string url The requested URL. |
public function testSendReturnAssoc() { $request = new SpotifyWebAPI\Request(); $request->setReturnAssoc(true); $response = $request->send('GET', 'https://api.spotify.com/v1/albums/7u6zL7kqpgLPISZYXNTgYk'); $this->assertArrayHasKey('id', $response['body']); }
public function testSendStatus() { $response = SpotifyWebAPI\Request::send('GET', 'https://api.spotify.com/v1/albums/7u6zL7kqpgLPISZYXNTgYk'); $this->assertEquals(200, $response['status']); }