-
Notifications
You must be signed in to change notification settings - Fork 349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Added user_agent argument to http methods #571
Conversation
require 'rest' | ||
|
||
resp = ::REST.head(url, 'User-Agent' => USER_AGENT) | ||
user_agent ||= USER_AGENT |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can also set that as the default?
def self.perform_head_request(url, user_agent = USER_AGENT)
# code
end
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did at first, but realized this method is private to http.rb, so it becomes easier to pass nil at the call site(s) and then substitute it here (we could also expose the USER_AGENT
default value as public, if you'd prefer).
…a caller, so the social media validator can specify something different (Issue CocoaPods/CocoaPods#9049)
CHANGELOG.md
Outdated
@@ -45,6 +45,10 @@ | |||
[Eric Amorde](https://github.com/amorde) | |||
[CocoaPods/CocoaPods#8785](https://github.com/CocoaPods/CocoaPods/issues/8785) | |||
|
|||
* Pass a non-browser user agent for social media validation |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit add two empty spaces at the end of this line for markdown formatting.
lib/cocoapods-core/http.rb
Outdated
@@ -8,11 +8,11 @@ module HTTP | |||
# | |||
# @return [string] | |||
# | |||
def self.get_actual_url(url) | |||
def self.get_actual_url(url, user_agent=nil) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit formatting is off here use bundle exec rubocop -a
* Using change from CocoaPods/Core#571 to address Issue #9049 * Fixed bug, added changelog entry, fixed style violations * Updated non-browser user agent to 'CocoaPods' * Added PR CocoaPods/Core#571 as dependency until it's merged * Updated Gemfile to point to master branch for Core
This way a caller, like the social media validator, can specify something different (Issue CocoaPods/CocoaPods#9049)