Skip to content

Commit

Permalink
.file works now. Chrome was being lame. #19
Browse files Browse the repository at this point in the history
  • Loading branch information
basicallydan committed Dec 4, 2015
1 parent fd4b5d7 commit e9dc7a8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions examples-javascript/fluent-image-file.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ 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('/jay-peg.jpg').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) {
request('http://localhost:3030/jay-peg.jpg', 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
Expand Down
2 changes: 2 additions & 0 deletions examples-javascript/fluent-image.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ interfake.get('/pee-en-gee').image('./examples-javascript/assets/20x20-image-red
interfake.listen(3030); // The server will listen on port 3030

request('http://localhost:3030/jay-peg', function (error, response, body) {
console.log(response.headers['content-disposition']); // prints undefined
console.log(response.headers['content-type']); // prints image/jpeg
});

request('http://localhost:3030/pee-en-gee', function (error, response, body) {
console.log(response.headers['content-disposition']); // prints undefined
console.log(response.headers['content-type']); // prints image/png
});

0 comments on commit e9dc7a8

Please sign in to comment.