Skip to content

Commit 2f0d3b0

Browse files
etabakovAlexander Vakrilov
authored andcommitted
Add RssFeed to the ContentTypes considered as text (NativeScript#4820)
1 parent 9ad297f commit 2f0d3b0

2 files changed

Lines changed: 20 additions & 0 deletions

File tree

tests/app/xhr/xhr-tests.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,25 @@ export function test_xhr_events() {
267267
TKUnit.assertEqual(errorEventData, 'error data');
268268
}
269269

270+
export function test_xhr_responseType_rss() {
271+
const xhr = <any>new XMLHttpRequest();
272+
const rawRssFeed = '<rss> <channel><item><title>Test</title></item></channel></rss>';
273+
const response = {
274+
statusCode: 200,
275+
content: {
276+
toString: function(){ return this.raw },
277+
raw: rawRssFeed
278+
},
279+
headers: {
280+
"Content-Type": "application/rss+xml"
281+
}
282+
}
283+
284+
xhr._loadResponse(response);
285+
TKUnit.assertEqual(xhr.responseType, "text");
286+
TKUnit.assertEqual(xhr.response, rawRssFeed);
287+
}
288+
270289
export function test_xhr_responseType_text() {
271290
const xhr = <any>new XMLHttpRequest();
272291
const response = {

tns-core-modules/xhr/xhr.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,7 @@ export class XMLHttpRequest {
131131
private textTypes: string[] = [
132132
'text/plain',
133133
'application/xml',
134+
'application/rss+xml',
134135
'text/html',
135136
'text/xml'
136137
];

0 commit comments

Comments
 (0)