-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(web-server): add support for custom headers in files served
- Loading branch information
Showing
6 changed files
with
78 additions
and
3 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
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,26 @@ | ||
Feature: Custom Headers | ||
In order to use Karma | ||
As a person who wants to write great tests | ||
I want to Karma to send custom headers on files sent. | ||
|
||
Scenario: Simple file with headers | ||
Given a configuration with: | ||
""" | ||
files = ['headers/*.js']; | ||
browsers = ['PhantomJS']; | ||
plugins = [ | ||
'karma-jasmine', | ||
'karma-phantomjs-launcher' | ||
]; | ||
customHeaders = [{ | ||
match: 'foo.js', | ||
name: 'Custom-Header-Awesomeness', | ||
value: 'there.is.no.dana.only.zuul' | ||
}]; | ||
""" | ||
When I start Karma | ||
Then it passes with: | ||
""" | ||
. | ||
PhantomJS | ||
""" |
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 @@ | ||
'/base/headers/foo.js source' |
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,14 @@ | ||
function httpGet (url) { | ||
var xmlHttp = new XMLHttpRequest() | ||
|
||
xmlHttp.open('GET', url, false) | ||
xmlHttp.send(null) | ||
|
||
return xmlHttp | ||
} | ||
|
||
describe('setting custom headers', function () { | ||
it('should get custom headers', function () { | ||
expect(httpGet('/base/headers/foo.js').getResponseHeader('Custom-Header-Awesomeness')).toBe('there.is.no.dana.only.zuul') | ||
}) | ||
}) |