{"id":17644792,"url":"https://github.com/spike1292/tns-ng-http-test","last_synced_at":"2025-03-30T07:12:29.837Z","repository":{"id":71994280,"uuid":"82857757","full_name":"spike1292/tns-ng-http-test","owner":"spike1292","description":"{N} 2.5.0 with angular on iOS an http response with Content-Type text/xml the result of `response.text()` is a string with \u003chex\u003e values instead of a string with xml","archived":false,"fork":false,"pushed_at":"2017-02-22T23:17:38.000Z","size":2138,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-05T09:16:41.326Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/spike1292.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-02-22T22:13:10.000Z","updated_at":"2017-02-22T23:13:09.000Z","dependencies_parsed_at":null,"dependency_job_id":"fd1b761b-52e1-4d9a-86af-92f3333e3110","html_url":"https://github.com/spike1292/tns-ng-http-test","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spike1292%2Ftns-ng-http-test","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spike1292%2Ftns-ng-http-test/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spike1292%2Ftns-ng-http-test/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/spike1292%2Ftns-ng-http-test/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/spike1292","download_url":"https://codeload.github.com/spike1292/tns-ng-http-test/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246285816,"owners_count":20752956,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-23T10:40:05.721Z","updated_at":"2025-03-30T07:12:29.815Z","avatar_url":"https://github.com/spike1292.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Support for `text/xml`\n\nOur api returns a http response with header `Content-Type` `text/xml`\n\nThe current nativescript implementation of [xhr](https://github.com/NativeScript/NativeScript/blob/master/tns-core-modules/xhr/xhr.ts#L131) does't support `text/xml` \n\nthe RFC ([3023](http://www.rfc-editor.org/rfc/rfc3023.txt)) speficies under section 3, XML Media Types:\n\u003e If an XML document -- that is, the unprocessed, source XML document -- is readable by casual users, text/xml is preferable to application/xml. MIME user agents (and web user agents) that do not have explicit support for text/xml will treat it as text/plain, for example, by displaying the XML MIME entity as plain text. Application/xml is preferable when the XML MIME entity is unreadable by casual users.\n\nAccording to the RFC the `text/xml` should be treated as plain text. \n\nSo when executing a http request with Angular the expected result is a string with plain text\n```typescript\ngetTextXML(): Observable\u003cString\u003e{\n    return this.http.get('http://mockbin.org/bin/ebed6ca6-f882-4843-847d-b5d6767116d9')\n        .map((res: Response) =\u003e res.text());\n}\n```\n\nBut the result of a http request with `Content-type` `text/xml` results in a string with hex values.\n\nResult of `response.text()` with `Content-Type` `text/xml`:\n![text/xml](./media/textxml.png)\n\nResult of `response.text()` with `Content-Type` `application/xml`:\n![application/xml](./media/applicationxml.png)\n\n## Endpoints\n[Mock endpoint with `Content-Type` `text/xml`](http://mockbin.org/bin/ebed6ca6-f882-4843-847d-b5d6767116d9/view)\n\n[Mock endpoint with `Content-Type` `application/xml`](http://mockbin.org/bin/f2b097e0-8ee0-4366-b4e9-b5343acfedd8/view)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspike1292%2Ftns-ng-http-test","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fspike1292%2Ftns-ng-http-test","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fspike1292%2Ftns-ng-http-test/lists"}