@@ -58,7 +58,7 @@ describe('raven.parsers', function(){
58
58
it ( 'should detect headers via `req.headers`' , function ( ) {
59
59
var mockReq = {
60
60
method : 'GET' ,
61
- host : 'mattrobenolt.com' ,
61
+ hostname : 'mattrobenolt.com' ,
62
62
url : '/some/path?key=value' ,
63
63
headers : {
64
64
foo : 'bar'
@@ -73,7 +73,7 @@ describe('raven.parsers', function(){
73
73
it ( 'should detect headers via `req.header`' , function ( ) {
74
74
var mockReq = {
75
75
method : 'GET' ,
76
- host : 'mattrobenolt.com' ,
76
+ hostname : 'mattrobenolt.com' ,
77
77
url : '/some/path?key=value' ,
78
78
header : {
79
79
foo : 'bar'
@@ -90,7 +90,7 @@ describe('raven.parsers', function(){
90
90
it ( 'should detect method via `req.method`' , function ( ) {
91
91
var mockReq = {
92
92
method : 'GET' ,
93
- host : 'mattrobenolt.com' ,
93
+ hostname : 'mattrobenolt.com' ,
94
94
url : '/some/path?key=value'
95
95
} ;
96
96
@@ -101,7 +101,19 @@ describe('raven.parsers', function(){
101
101
} ) ;
102
102
103
103
describe ( '`host` detection' , function ( ) {
104
- it ( 'should detect host via `req.host`' , function ( ) {
104
+ it ( 'should detect host via `req.hostname`' , function ( ) {
105
+ var mockReq = {
106
+ method : 'GET' ,
107
+ hostname : 'mattrobenolt.com' ,
108
+ url : '/some/path?key=value'
109
+ } ;
110
+
111
+ var parsed = raven . parsers . parseRequest ( mockReq ) ;
112
+
113
+ parsed [ 'request' ] . url . should . equal ( 'http://mattrobenolt.com/some/path?key=value' ) ;
114
+ } ) ;
115
+
116
+ it ( 'should detect host via deprecated `req.host`' , function ( ) {
105
117
var mockReq = {
106
118
method : 'GET' ,
107
119
host : 'mattrobenolt.com' ,
@@ -243,7 +255,7 @@ describe('raven.parsers', function(){
243
255
it ( 'should detect query via `req.query`' , function ( ) {
244
256
var mockReq = {
245
257
method : 'GET' ,
246
- host : 'mattrobenolt.com' ,
258
+ hostname : 'mattrobenolt.com' ,
247
259
url : '/some/path?key=value' ,
248
260
query : { some : 'key' }
249
261
} ;
@@ -256,7 +268,7 @@ describe('raven.parsers', function(){
256
268
it ( 'should detect query via `req.url`' , function ( ) {
257
269
var mockReq = {
258
270
method : 'GET' ,
259
- host : 'mattrobenolt.com' ,
271
+ hostname : 'mattrobenolt.com' ,
260
272
url : '/some/path?foo=bar' ,
261
273
} ;
262
274
@@ -272,7 +284,7 @@ describe('raven.parsers', function(){
272
284
method : 'GET' ,
273
285
url : '/some/path?key=value' ,
274
286
headers : {
275
- host : 'mattrobenolt.com' ,
287
+ hostname : 'mattrobenolt.com' ,
276
288
} ,
277
289
ip : '69.69.69.69'
278
290
} ;
@@ -287,7 +299,7 @@ describe('raven.parsers', function(){
287
299
method : 'GET' ,
288
300
url : '/some/path?key=value' ,
289
301
headers : {
290
- host : 'mattrobenolt.com' ,
302
+ hostname : 'mattrobenolt.com' ,
291
303
} ,
292
304
connection : {
293
305
remoteAddress : '69.69.69.69'
@@ -305,7 +317,7 @@ describe('raven.parsers', function(){
305
317
var mockReq = {
306
318
method : 'GET' ,
307
319
protocol : 'https' ,
308
- host : 'mattrobenolt.com' ,
320
+ hostname : 'mattrobenolt.com' ,
309
321
originalUrl : '/some/path?key=value'
310
322
} ;
311
323
@@ -318,7 +330,7 @@ describe('raven.parsers', function(){
318
330
var mockReq = {
319
331
method : 'GET' ,
320
332
protocol : 'https' ,
321
- host : 'mattrobenolt.com' ,
333
+ hostname : 'mattrobenolt.com' ,
322
334
url : '/some/path?key=value'
323
335
} ;
324
336
@@ -332,7 +344,7 @@ describe('raven.parsers', function(){
332
344
it ( 'should detect body via `req.body`' , function ( ) {
333
345
var mockReq = {
334
346
method : 'GET' ,
335
- host : 'mattrobenolt.com' ,
347
+ hostname : 'mattrobenolt.com' ,
336
348
url : '/some/path?key=value' ,
337
349
body : 'foo=bar'
338
350
} ;
@@ -345,7 +357,7 @@ describe('raven.parsers', function(){
345
357
it ( 'should fallback to <unavailable> if body is not available' , function ( ) {
346
358
var mockReq = {
347
359
method : 'GET' ,
348
- host : 'mattrobenolt.com' ,
360
+ hostname : 'mattrobenolt.com' ,
349
361
url : '/some/path?key=value' ,
350
362
body : ''
351
363
} ;
0 commit comments