File tree 2 files changed +18
-1
lines changed
2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -702,8 +702,12 @@ protected function _buildDefaultHeaders($includeAccessToken = true)
702
702
*
703
703
* @access protected
704
704
*/
705
- protected function _buildUrl ($ path , $ params = null , $ includeVersion = true )
705
+ protected function _buildUrl ($ path , $ params = array () , $ includeVersion = true )
706
706
{
707
+ if (!$ this ->_accessToken ) {
708
+ $ params ['consumer_key ' ] = $ this ->_clientId ;
709
+ }
710
+
707
711
if (preg_match ('/^https?\:\/\// ' , $ path )) {
708
712
$ url = $ path ;
709
713
} else {
Original file line number Diff line number Diff line change @@ -11,6 +11,8 @@ function setUp() {
11
11
'1337 ' ,
12
12
'http://soundcloud.local/callback '
13
13
);
14
+
15
+ $ this ->soundcloud ->setAccessToken ('1337 ' );
14
16
}
15
17
16
18
function tearDown () {
@@ -189,6 +191,8 @@ function testResponseCodeServerError() {
189
191
}
190
192
191
193
function testBuildDefaultHeaders () {
194
+ $ this ->soundcloud ->setAccessToken (null );
195
+
192
196
self ::assertEquals (
193
197
array ('Accept: application/json ' ),
194
198
$ this ->soundcloud ->buildDefaultHeaders ()
@@ -252,6 +256,15 @@ function testBuildUrlWithAbsoluteUrl() {
252
256
);
253
257
}
254
258
259
+ function testBuildUrlWithoutAccessToken () {
260
+ $ this ->soundcloud ->setAccessToken (null );
261
+
262
+ self ::assertEquals (
263
+ 'https://api.soundcloud.com/v1/tracks?consumer_key=1337 ' ,
264
+ $ this ->soundcloud ->buildUrl ('tracks ' )
265
+ );
266
+ }
267
+
255
268
/**
256
269
* @dataProvider dataProviderHttpHeaders
257
270
*/
You can’t perform that action at this time.
0 commit comments