From 2f0d3b0e0bc049d20e943cd88ca9241fb3541887 Mon Sep 17 00:00:00 2001 From: Emil Tabakov Date: Sat, 9 Sep 2017 15:45:07 +0300 Subject: [PATCH] Add RssFeed to the ContentTypes considered as text (#4820) --- tests/app/xhr/xhr-tests.ts | 19 +++++++++++++++++++ tns-core-modules/xhr/xhr.ts | 1 + 2 files changed, 20 insertions(+) diff --git a/tests/app/xhr/xhr-tests.ts b/tests/app/xhr/xhr-tests.ts index f5a8dca8d..69af7ee51 100644 --- a/tests/app/xhr/xhr-tests.ts +++ b/tests/app/xhr/xhr-tests.ts @@ -267,6 +267,25 @@ export function test_xhr_events() { TKUnit.assertEqual(errorEventData, 'error data'); } +export function test_xhr_responseType_rss() { + const xhr = new XMLHttpRequest(); + const rawRssFeed = ' Test'; + const response = { + statusCode: 200, + content: { + toString: function(){ return this.raw }, + raw: rawRssFeed + }, + headers: { + "Content-Type": "application/rss+xml" + } + } + + xhr._loadResponse(response); + TKUnit.assertEqual(xhr.responseType, "text"); + TKUnit.assertEqual(xhr.response, rawRssFeed); +} + export function test_xhr_responseType_text() { const xhr = new XMLHttpRequest(); const response = { diff --git a/tns-core-modules/xhr/xhr.ts b/tns-core-modules/xhr/xhr.ts index bbdf5402e..a4d71ea97 100644 --- a/tns-core-modules/xhr/xhr.ts +++ b/tns-core-modules/xhr/xhr.ts @@ -131,6 +131,7 @@ export class XMLHttpRequest { private textTypes: string[] = [ 'text/plain', 'application/xml', + 'application/rss+xml', 'text/html', 'text/xml' ];