@@ -21,21 +21,16 @@ public function requestResource(Application $app)
2121 // pull the token from the request
2222 $ token = $ app ['request ' ]->get ('token ' );
2323
24- // make the resource request with the token in the request body
25- $ config ['resource_params ' ]['access_token ' ] = $ token ;
26-
2724 // determine the resource endpoint to call based on our config (do this somewhere else?)
2825 $ apiRoute = $ config ['resource_route ' ];
29- $ endpoint = 0 === strpos ($ apiRoute , 'http ' ) ? $ apiRoute : $ urlgen ->generate ($ apiRoute , $ config [ ' resource_params ' ] , true );
26+ $ endpoint = 0 === strpos ($ apiRoute , 'http ' ) ? $ apiRoute : $ urlgen ->generate ($ apiRoute , array () , true );
3027
3128 // make the resource request and decode the json response
3229 $ request = $ http ->get ($ endpoint , null , $ config ['http_options ' ]);
3330 $ request ->getQuery ()->set ('access_token ' , $ token );
3431 $ response = $ request ->send ();
3532 $ json = json_decode ((string ) $ response ->getBody (), true );
3633
37- $ resource_uri = sprintf ('%s%saccess_token=%s ' , $ endpoint , false === strpos ($ endpoint , '? ' ) ? '? ' : '& ' , $ token );
38-
39- return $ twig ->render ('client/show_resource.twig ' , array ('response ' => $ json ? $ json : $ response , 'resource_uri ' => $ resource_uri ));
34+ return $ twig ->render ('client/show_resource.twig ' , array ('response ' => $ json ? $ json : $ response , 'resource_uri ' => $ request ->getUrl ()));
4035 }
4136}
0 commit comments