Skip to content
This repository has been archived by the owner on Jun 29, 2023. It is now read-only.

Fix content-type headers #65

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion lib/create_api_gem/forms/requests/create_form_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def initialize(form, token: APIConfig.token)
method: :post,
url: "#{APIConfig.api_request_url}/forms",
headers: {
'Authorization' => "Bearer #{token}"
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
},
payload: form.payload
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ def initialize(form, messages, token: APIConfig.token)
method: :put,
url: "#{APIConfig.api_request_url}/forms/#{form.id}/messages",
headers: {
'Authorization' => "Bearer #{token}"
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
},
payload: messages.payload
)
Expand Down
3 changes: 2 additions & 1 deletion lib/create_api_gem/forms/requests/update_form_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def initialize(form, token: APIConfig.token)
method: :put,
url: "#{APIConfig.api_request_url}/forms/#{form.id}",
headers: {
'Authorization' => "Bearer #{token}"
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
},
payload: form.payload
)
Expand Down
1 change: 0 additions & 1 deletion lib/create_api_gem/images/requests/delete_image_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def initialize(image, token: APIConfig.token)
method: :delete,
url: "#{APIConfig.api_request_url}/images/#{image.id}",
headers: {
'Content-Type' => 'application/json',
'Authorization' => "Bearer #{token}"
}
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ def initialize(token: APIConfig.token)
method: :get,
url: "#{APIConfig.api_request_url}/images",
headers: {
'Content-Type' => 'application/json',
'Authorization' => "Bearer #{token}"
}
)
Expand Down
5 changes: 1 addition & 4 deletions lib/create_api_gem/images/requests/retrieve_frame_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ class RetrieveFrameRequest < ImageRequest
def initialize(image, frame)
request(
method: :get,
url: "#{APIConfig.image_api_request_url}/images/#{image.id}/image/default-#{frame}frame.png",
headers: {
'Content-Type' => 'application/json'
}
url: "#{APIConfig.image_api_request_url}/images/#{image.id}/image/default-#{frame}frame.png"
)
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def initialize(image, type: nil, size: nil, accept: nil)
else
"#{APIConfig.api_request_url}/images/#{image.id}/#{type}/#{size}"
end
headers = { 'Content-Type' => 'application/json' }
headers = { }
headers['Accept'] = 'application/json' if accept == 'json'
request(
method: :get,
Expand Down
3 changes: 2 additions & 1 deletion lib/create_api_gem/teams/requests/update_team_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def initialize(operations, token: APIConfig.token)
method: :patch,
url: "#{APIConfig.api_request_url}/teams/mine",
headers: {
'Authorization' => "Bearer #{token}"
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
},
payload: operations.map(&:payload).to_json
)
Expand Down
3 changes: 2 additions & 1 deletion lib/create_api_gem/themes/requests/create_theme_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def initialize(theme, token: APIConfig.token)
method: :post,
url: "#{APIConfig.api_request_url}/themes",
headers: {
'Authorization' => "Bearer #{token}"
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
},
payload: theme.payload
)
Expand Down
3 changes: 2 additions & 1 deletion lib/create_api_gem/themes/requests/update_theme_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@ def initialize(theme, token: APIConfig.token)
method: :put,
url: "#{APIConfig.api_request_url}/themes/#{theme.id}",
headers: {
'Authorization' => "Bearer #{token}"
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
},
payload: theme.payload
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def initialize(workspace, token: APIConfig.token)
method: :delete,
url: "#{APIConfig.workspaces_api_request_url}/#{workspace.id}",
headers: {
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
'Authorization' => "Bearer #{token}"
}
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ def initialize(token: APIConfig.token, workspaces_per_page: 10, page: nil, searc
method: :get,
url: url,
headers: {
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
'Authorization' => "Bearer #{token}"
}
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def initialize(token: APIConfig.token)
method: :get,
url: "#{APIConfig.workspaces_api_request_url}/default",
headers: {
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
'Authorization' => "Bearer #{token}"
}
)
end
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,7 @@ def initialize(workspace, token: APIConfig.token)
method: :get,
url: "#{APIConfig.workspaces_api_request_url}/#{workspace.id}",
headers: {
'Authorization' => "Bearer #{token}",
'Content-Type' => 'application/json'
'Authorization' => "Bearer #{token}"
}
)
end
Expand Down