File tree 6 files changed +11
-11
lines changed
lib/pact_broker/api/resources
lib/pact_broker/api/resources
6 files changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -96,12 +96,12 @@ def pact_params
96
96
end
97
97
98
98
def set_json_error_message message
99
- response . headers [ 'Content-Type' ] = 'application/json;charset=utf-8'
99
+ response . headers [ 'Content-Type' ] = 'application/hal+ json;charset=utf-8'
100
100
response . body = { error : message } . to_json
101
101
end
102
102
103
103
def set_json_validation_error_messages errors
104
- response . headers [ 'Content-Type' ] = 'application/json;charset=utf-8'
104
+ response . headers [ 'Content-Type' ] = 'application/hal+ json;charset=utf-8'
105
105
response . body = { errors : errors } . to_json
106
106
end
107
107
@@ -128,7 +128,7 @@ def invalid_json?
128
128
rescue StandardError => e
129
129
logger . error "Error parsing JSON #{ e } - #{ request_body } "
130
130
set_json_error_message "Error parsing JSON - #{ e . message } "
131
- response . headers [ 'Content-Type' ] = 'application/json;charset=utf-8'
131
+ response . headers [ 'Content-Type' ] = 'application/hal+ json;charset=utf-8'
132
132
true
133
133
end
134
134
end
Original file line number Diff line number Diff line change @@ -38,7 +38,7 @@ def validation_errors? webhook
38
38
errors = webhook_service . errors ( webhook )
39
39
40
40
unless errors . empty?
41
- response . headers [ 'Content-Type' ] = 'application/json;charset=utf-8'
41
+ response . headers [ 'Content-Type' ] = 'application/hal+ json;charset=utf-8'
42
42
response . body = { errors : errors . messages } . to_json
43
43
end
44
44
Original file line number Diff line number Diff line change 24
24
25
25
it "returns a JSON content type" do
26
26
subject
27
- expect ( last_response . headers [ 'Content-Type' ] ) . to eq 'application/json;charset=utf-8'
27
+ expect ( last_response . headers [ 'Content-Type' ] ) . to eq 'application/hal+ json;charset=utf-8'
28
28
end
29
29
30
30
it "returns the validation errors" do
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ module Resources
76
76
end
77
77
78
78
it "returns a JSON content type" do
79
- expect ( response . headers [ 'Content-Type' ] ) . to eq "application/json;charset=utf-8"
79
+ expect ( response . headers [ 'Content-Type' ] ) . to eq "application/hal+ json;charset=utf-8"
80
80
end
81
81
82
82
it "returns an error message" do
Original file line number Diff line number Diff line change @@ -93,7 +93,7 @@ module Resources
93
93
94
94
it "returns a JSON content type" do
95
95
subject
96
- expect ( last_response . headers [ 'Content-Type' ] ) . to eq 'application/json;charset=utf-8'
96
+ expect ( last_response . headers [ 'Content-Type' ] ) . to eq 'application/hal+ json;charset=utf-8'
97
97
end
98
98
99
99
it "returns an error message" do
@@ -111,7 +111,7 @@ module Resources
111
111
112
112
it "returns a JSON content type" do
113
113
subject
114
- expect ( last_response . headers [ 'Content-Type' ] ) . to eq 'application/json;charset=utf-8'
114
+ expect ( last_response . headers [ 'Content-Type' ] ) . to eq 'application/hal+ json;charset=utf-8'
115
115
end
116
116
117
117
it "returns an error message" do
@@ -132,7 +132,7 @@ module Resources
132
132
133
133
it "returns a JSON content type" do
134
134
subject
135
- expect ( last_response . headers [ 'Content-Type' ] ) . to eq 'application/json;charset=utf-8'
135
+ expect ( last_response . headers [ 'Content-Type' ] ) . to eq 'application/hal+ json;charset=utf-8'
136
136
end
137
137
138
138
it "returns the validation errors" do
Original file line number Diff line number Diff line change 24
24
25
25
RSpec ::Matchers . define :be_a_json_response do
26
26
match do | actual |
27
- expect ( actual . headers [ 'Content-Type' ] ) . to eq 'application/json;charset=utf-8'
27
+ expect ( actual . headers [ 'Content-Type' ] ) . to eq 'application/hal+ json;charset=utf-8'
28
28
end
29
29
end
30
30
31
31
RSpec ::Matchers . define :be_a_json_error_response do | message |
32
32
match do | actual |
33
33
expect ( actual . status ) . to be 400
34
- expect ( actual . headers [ 'Content-Type' ] ) . to eq 'application/json;charset=utf-8'
34
+ expect ( actual . headers [ 'Content-Type' ] ) . to eq 'application/hal+ json;charset=utf-8'
35
35
expect ( actual . body ) . to include message
36
36
end
37
37
end
You can’t perform that action at this time.
0 commit comments