-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added .file to make images or whatever downloadable.
- Loading branch information
1 parent
5af1071
commit fd4b5d7
Showing
5 changed files
with
59 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
var Interfake = require('..'); | ||
var request = require('request'); // Let's use request for this example | ||
|
||
var interfake = new Interfake({ debug: true }); | ||
interfake.get('/jay-peg').status(200).file('./examples-javascript/assets/20x20-image-redjpg.jpg'); | ||
interfake.get('/pee-en-gee').status(200).file('./examples-javascript/assets/20x20-image-redpng.png'); | ||
interfake.listen(3030); // The server will listen on port 3030 | ||
|
||
request('http://localhost:3030/jay-peg', function (error, response, body) { | ||
console.log(response.statusCode); // prints 200 | ||
console.log(response.headers['content-disposition']); // prints attachment; 20x20-image-redjpg.jpg | ||
console.log(response.headers['content-type']); // prints image/jpeg | ||
}); | ||
|
||
request('http://localhost:3030/pee-en-gee', function (error, response, body) { | ||
console.log(response.statusCode); // prints 200 | ||
console.log(response.headers['content-disposition']); // prints attachment; 20x20-image-redpng.png | ||
console.log(response.headers['content-type']); // prints image/png | ||
}); |
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