Skip to content
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

Updates for Firebase Remote Config #34

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
include required headers in get remote config request
  • Loading branch information
doc-rj-ebay committed May 23, 2024
commit b459f5170435d28e12d690cac231a2494adb5e76
19 changes: 14 additions & 5 deletions lib/remocon/command/lib/request.rb
Original file line number Diff line number Diff line change
@@ -53,11 +53,19 @@ def self.validate(config, config_temp_file)
end

def self.pull(config)
raw_json, etag = open(config.endpoint, "Authorization" => "Bearer #{config.token}") do |io|
[io.read, io.meta["etag"]]
end
client, uri = Request.build_client(config)

headers = {
"Authorization" => "Bearer #{config.token}",
"Content-Type" => "application/json; UTF8",
"Content-Encoding" => "gzip",
}

request = Net::HTTP::Get.new(uri.request_uri, headers)

[raw_json, etag]
response = client.request(request)

[response.body, response.header["etag"]]
end

def self.fetch_etag(config)
@@ -68,10 +76,11 @@ def self.fetch_etag(config)
headers = {
"Authorization" => "Bearer #{config.token}",
"Content-Type" => "application/json; UTF8",
"Content-Encoding" => "gzip",
"Content-Encoding" => "gzip"
}

request = Net::HTTP::Get.new(uri.request_uri, headers)

response = client.request(request)

response.kind_of?(Net::HTTPOK) && response.header["etag"]