diff --git a/test/get.js b/test/get.js index a57651b..15bdc51 100644 --- a/test/get.js +++ b/test/get.js @@ -159,6 +159,26 @@ module.exports.multiple = function (assert) { }, 5000); } +module.exports.function_url = function (assert) { + osmosis.get(url + '/xml-auto') + .then(function (context, data) { + assert.equal(context.get('link').text(), 'http://example.com'); + }) + .get(url + '/xml') + .then(function (context, data) { + // In html mode tag treated as singleton tag and can't have any body + assert.notEqual(context.get('link').text(), 'http://example.com'); + }) + .get(url + '/xml') + .config('parse_as', 'xml') + .then(function (context, data) { + assert.equal(context.get('link').text(), 'http://example.com'); + }) + .done(function () { + assert.done(); + }); +}; + module.exports.absentQueryString = function (assert) { var found = false; osmosis.get(url + '/test-query-string') @@ -202,6 +222,17 @@ server('/error-parse', function (url, req, res) { res.end(); }); +server('/xml-auto', function (url, req, res) { + res.setHeader('Content-Type', 'application/xml'); + res.write('http://example.com'); + res.end(); +}); + +server('/xml', function (url, req, res) { + res.write('http://example.com'); + res.end(); +}); + server('/redirect', function (url, req, res) { res.write('
/redirect
');