Closed stevenmaguire closed 9 years ago
Looks nice. Let me sit on this for a day or two. Could you update the variable names to camelCase
throughout?
I know I'm annoying... :)
@bencorlett D'oh! Old habits die hard. New commit is in.
Merged! Thanks :)
Released 1.2.0
to respect Semver with this new functionality.
w00t! Thanks @bencorlett
In response to https://github.com/thephpleague/oauth1-client/issues/8, this PR proposes a solution that includes a new
setUserAgent
method which sets a protected property on the baseServer
class, so all vendor specific implementations can utilize this feature.When building the
Authorization
header for each request, the custom header is passed into abuildHttpClientHeaders
method, where it is merged with a default set of headers. This default set of headers is empty unless theuserAgent
is set, in which case it will include the header in the response.This solution does not provide a method to unset the
userAgent
property, but thesetUserAgent
method accepts and sets null.Additionally, the merge is configured in such a way that each of the requesting methods can set User-Agent independently and it will not be overwritten.
There is a new test that covers these new methods as well as an update to existing test to cover the case where the
userAgent
is not set, ensuring noUser-Agent
header is sent.