22
33var express = require ( 'express' ) ,
44 request = require ( 'supertest' ) ,
5- bodyParser = require ( 'body-parser' ) ,
6- expect = require ( 'chai' ) . expect ;
5+ bodyParser = require ( 'body-parser' ) ;
76
87// Add xml parsing to bodyParser.
98// In real-life you'd `require('body-parser-xml')`.
@@ -14,6 +13,7 @@ describe('XML Body Parser', function() {
1413
1514 var createServer = function ( options ) {
1615 app = express ( ) ;
16+ app . set ( 'env' , 'test' ) ;
1717 app . use ( bodyParser . xml ( options ) ) ;
1818 app . post ( '/' , function ( req , res ) {
1919 res . status ( 200 ) . send ( { parsed : req . body } ) ;
@@ -44,6 +44,16 @@ describe('XML Body Parser', function() {
4444 . expect ( 200 , { parsed : { customer : { name : [ 'Bob' ] } } } , done ) ;
4545 } ) ;
4646
47+ it ( 'should parse a body with content-type application/rss+xml' , function ( done ) {
48+ createServer ( ) ;
49+
50+ request ( app )
51+ . post ( '/' )
52+ . set ( 'Content-Type' , 'application/rss+xml' )
53+ . send ( '<customer><name>Bob</name></customer>' )
54+ . expect ( 200 , { parsed : { customer : { name : [ 'Bob' ] } } } , done ) ;
55+ } ) ;
56+
4757 it ( 'should accept xmlParseOptions' , function ( done ) {
4858 createServer ( {
4959 xmlParseOptions : {
0 commit comments