Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix response headers being rendered incorrectly. (#23)
- Loading branch information
1 parent
8af068e
commit 1456475
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#%RAML 1.0 | ||
title: Consistent Headers | ||
|
||
|
||
/A: | ||
get: | ||
headers: | ||
X-Some-Header: string | ||
responses: | ||
200: | ||
headers: | ||
X-Some-Other-Header: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* eslint-env node, mocha */ | ||
|
||
'use strict'; | ||
|
||
const raml2obj = require('..'); | ||
const assert = require('assert'); | ||
|
||
describe('raml2obj', () => { | ||
describe('consistent-headers.raml', () => { | ||
let obj; | ||
|
||
before((done) => { | ||
raml2obj.parse('test/consistent-headers.raml').then((result) => { | ||
obj = result; | ||
done(); | ||
}, (error) => { | ||
console.log('error', error); | ||
}); | ||
}); | ||
|
||
it('should have keys on both request and response headers', () => { | ||
assert.strictEqual(obj.resources[0].methods[0].headers[0].key, 'X-Some-Header'); | ||
assert.strictEqual(obj.resources[0].methods[0].responses[0].headers[0].key, 'X-Some-Other-Header'); | ||
}); | ||
}); | ||
}); |