Note: Mashape provides 2 keys for each application: a 'Testing' and a 'Production' one.
Be aware of which key you are using and do not share your Production key.
public static setMashapeKey ( string $key ) : string | ||
$key | string | Mashape key |
리턴 | string |
public function testSetMashapeKey() { Request::setMashapeKey('abcd'); $response = Request::get('http://mockbin.com/request'); $this->assertEquals(200, $response->code); $this->assertTrue(property_exists($response->body->headers, 'x-mashape-key')); $this->assertEquals('abcd', $response->body->headers->{'x-mashape-key'}); // send another request $response = Request::get('http://mockbin.com/request'); $this->assertEquals(200, $response->code); $this->assertTrue(property_exists($response->body->headers, 'x-mashape-key')); $this->assertEquals('abcd', $response->body->headers->{'x-mashape-key'}); Request::clearDefaultHeaders(); $response = Request::get('http://mockbin.com/request'); $this->assertEquals(200, $response->code); $this->assertFalse(property_exists($response->body->headers, 'x-mashape-key')); }