Skip to content

Commit

Permalink
change Code for HOST header
Browse files Browse the repository at this point in the history
  • Loading branch information
ReneHaensel committed Jan 16, 2025
1 parent ea5e7c1 commit da96257
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/nfdi4health/csh_client.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'rest-client'
require 'uri'

module Nfdi4Health

Expand All @@ -13,14 +14,14 @@ def initialize()
end
def publish_csh(project_transformed,token)
content_length = project_transformed.bytesize
headers = { content_type: 'application/json',Content_Length: content_length ,Host: 'csh.nfdi4health.de', Authorization: 'Bearer ' + token
headers = { content_type: 'application/json',Content_Length: content_length ,Host: "#{URI.parse(@url_publish).host}", Authorization: 'Bearer ' + token
}

@endpoint = RestClient::Request.execute(method: :post, url: @url_publish, payload: project_transformed, headers: headers)
end

def publish_csh_confirm(id,token)
headers = { content_type: 'application/json',Content_Length: '0' ,Host: 'csh.nfdi4health.de', Authorization: 'Bearer ' + token
headers = { content_type: 'application/json',Content_Length: '0' ,Host: "#{URI.parse(@url_publish).host}", Authorization: 'Bearer ' + token
}

@endpoint = RestClient::Request.execute(method: :post, url: "#{@url_publish}#{id}/publish", headers: headers)
Expand Down

0 comments on commit da96257

Please sign in to comment.