Skip to content
This repository has been archived by the owner on May 9, 2022. It is now read-only.

Commit

Permalink
FE-4875: include explicit Content-Type in the FishEye service
Browse files Browse the repository at this point in the history
  • Loading branch information
miszobi committed Sep 19, 2013
1 parent 7a8b486 commit 7face0e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/services/fisheye.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ def receive_push
verify_config

http.headers['X-Api-Key'] = token
http.headers['Content-Type'] = 'application/json'

url = "%s/rest-service-fecru/admin/repositories-v1/%s/scan" % [url_base, repository_name]

Expand Down
10 changes: 10 additions & 0 deletions test/fisheye_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,14 @@ def data_my_repo
}
end

def assert_headers_valid(env)
assert_equal(data_my_repo["token"], env[:request_headers]["X-Api-Key"])
assert_equal("application/json", env[:request_headers]["Content-Type"])
end

def test_triggers_scanning_custom_repository
@stubs.post "/foo/rest-service-fecru/admin/repositories-v1/myRepo/scan" do |env|
assert_headers_valid(env)
[200, {}]
end

Expand All @@ -30,6 +36,7 @@ def test_triggers_scanning_custom_repository

def test_triggers_scanning_url_with_slash
@stubs.post "/foo/rest-service-fecru/admin/repositories-v1/myRepo/scan" do |env|
assert_headers_valid(env)
[200, {}]
end

Expand All @@ -44,6 +51,7 @@ def test_triggers_scanning_url_with_slash

def test_triggers_scanning_url_without_http
@stubs.post "/foo/rest-service-fecru/admin/repositories-v1/myRepo/scan" do |env|
assert_headers_valid(env)
[200, {}]
end

Expand Down Expand Up @@ -74,6 +82,7 @@ def test_triggers_scanning_github_repository

def test_triggers_scanning_empty_custom_repository
@stubs.post "/foo/rest-service-fecru/admin/repositories-v1/grit/scan" do |env|
assert_headers_valid(env)
[200, {}]
end

Expand Down Expand Up @@ -139,6 +148,7 @@ def test_triggers_scanning_missing_data_and_payload

def test_triggers_scanning_missing_payload
@stubs.post "/foo/rest-service-fecru/admin/repositories-v1/myRepo/scan" do |env|
assert_headers_valid(env)
[200, {}]
end

Expand Down

0 comments on commit 7face0e

Please sign in to comment.