Skip to content

Commit 0a5a049

Browse files
dmathieuromanblanco
authored andcommitted
fix rack status which needs to be an integer
1 parent 64f0e51 commit 0a5a049

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

rswag-api/lib/rswag/api/middleware.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def call(env)
2828
body = unload_openapi(filename, openapi)
2929

3030
return [
31-
'200',
31+
200,
3232
headers,
3333
[body]
3434
]

rswag-api/spec/rswag/api/middleware_spec.rb

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828

2929
it 'returns a 200 status' do
3030
expect(response.length).to eql(3)
31-
expect(response.first).to eql('200')
31+
expect(response.first).to eql(200)
3232
end
3333

3434
it 'returns contents of the openapi file' do
@@ -44,7 +44,7 @@
4444

4545
it 'returns a 200 status' do
4646
expect(response.length).to eql(3)
47-
expect(response.first).to eql('200')
47+
expect(response.first).to eql(200)
4848
end
4949
end
5050
end
@@ -59,7 +59,7 @@
5959

6060
it 'returns a 200 status' do
6161
expect(response.length).to eql(3)
62-
expect(response.first).to eql('200')
62+
expect(response.first).to eql(200)
6363
end
6464

6565
it 'applies the headers to the response' do
@@ -74,7 +74,7 @@
7474

7575
it 'returns a 200 status' do
7676
expect(response.length).to eql(3)
77-
expect(response.first).to eql('200')
77+
expect(response.first).to eql(200)
7878
end
7979

8080
it 'applies the headers to the response' do
@@ -91,23 +91,23 @@
9191
let(:env) { env_defaults.merge('PATH_INFO' => 'foobar.json') }
9292

9393
before do
94-
allow(app).to receive(:call).and_return(['500', {}, []])
94+
allow(app).to receive(:call).and_return([500, {}, []])
9595
end
9696

9797
it 'delegates to the next middleware' do
98-
expect(response).to include('500')
98+
expect(response).to include(500)
9999
end
100100
end
101101

102102
context 'Disallow path traversing on path info' do
103103
let(:env) { env_defaults.merge('PATH_INFO' => '../traverse-secret.yml') }
104104

105105
before do
106-
allow(app).to receive(:call).and_return(['500', {}, []])
106+
allow(app).to receive(:call).and_return([500, {}, []])
107107
end
108108

109109
it 'delegates to the next middleware' do
110-
expect(response).to include('500')
110+
expect(response).to include(500)
111111
end
112112
end
113113

@@ -163,7 +163,7 @@
163163

164164
it 'returns a 200 status' do
165165
expect(response.length).to eql(3)
166-
expect(response.first).to eql('200')
166+
expect(response.first).to eql(200)
167167
end
168168

169169
it 'returns contents of the openapi file' do

0 commit comments

Comments
 (0)