0

When I try to do a http GET request but I have a "Failure response for https://httpbin.org/get: 0 Unknown Error.".

No CORS because no problem with POSTMAN ...

I have <tizen:privilege name="http://tizen.org/privilege/internet"/> in my config.xml

Anyone has already done an Angular2 / tizen app with http requests plz ?

I tried to add this httpheaders

  const httpOptions = {
  headers: new HttpHeaders({
    'Content-Type': 'application/json',
    'Access-Control-Allow-Origin': '*',
    'Access-Control-Allow-Credentials': 'true',
  }),
};


this.http
  .get(environment.apiBaseUrl + '/ScreenInfo/getDataTV', 
    httpOptions
  ).subscribe(data => {
    this.dataTv = 'OK ' + data;

  },
err => {
  this.dataTv = 'Err  ' + JSON.stringify(err);
});

Config.xml

  <?xml version="1.0" encoding="UTF-8"?>
  <widget xmlns="http://www.w3.org/ns/widgets" xmlns:tizen="http://tizen.org/ns/widgets" id="http://yourdomain/WanPlay" version="1.0.61" viewmodes="maximized">
<tizen:application id="xxx.xxx" package="xxx" required_version="2.3"/>
<content src="index.html"/>
<feature name="http://tizen.org/feature/screen.size.all"/>
<icon src="img/logo.png"/>
<name>xxx</name>
<tizen:privilege name="http://tizen.org/privilege/application.launch"/>
<tizen:privilege name="http://developer.samsung.com/privilege/productinfo"/>
<tizen:privilege name="http://developer.samsung.com/privilege/network.public"/>
<tizen:privilege name="http://developer.samsung.com/privilege/drmplay"/>
<tizen:privilege name="http://tizen.org/privilege/tv.inputdevice"/>
<tizen:privilege name="http://tizen.org/privilege/tv.window"/>
<tizen:privilege name="http://tizen.org/privilege/tv.channel"/>
<tizen:privilege name="http://tizen.org/privilege/tv.audio"/>
<tizen:privilege name="http://tizen.org/privilege/download"/>
<allow-navigation href="http://*/*"/>
<allow-intent href="http://*/*"/>
<allow-intent href="https://*/*"/>
<tizen:metadata key="http://samsung.com/tv/metadata/prelaunch.support" value="true"/>
<tizen:privilege name="http://tizen.org/privilege/internet"/>
<tizen:privilege name="http://tizen.org/privilege/tizen"/>
<tizen:privilege name="http://tizen.org/privilege/filesystem.read"/>
<tizen:privilege name="http://tizen.org/privilege/filesystem.write"/>
<tizen:privilege name="http://tizen.org/privilege/externalstorage"/>
<tizen:privilege name="http://tizen.org/privilege/unlimitedstorage"/>
<tizen:privilege name="http://tizen.org/privilege/mediastorage"/>
<tizen:allow-navigation>*</tizen:allow-navigation>
<tizen:content-security-policy>default-src *; script-src &apos;unsafe-inline&apos; *;</tizen:content-security-policy>
<access origin="*"/>
<tizen:profile name="tv"/>
jug
  • 441
  • 4
  • 10
  • 1
    `No CORS because no problem with POSTMAN`... postman works differently, you will not experience cors there: https://stackoverflow.com/questions/36250615/cors-with-postman – AT82 Nov 29 '21 at 09:49
  • @AT82 I also have other devices in 4G that are already do http requests on this API, without CORS – jug Nov 29 '21 at 09:57
  • 1
    Yeah, sorry, wasn't clear enough, I just wanted to mention that cors is not present in postman. Anyway, you need to provide a [mcve], no one is able to help you just based on an error message... – AT82 Nov 29 '21 at 10:00
  • Would you let us know your test environment? TV or Wearable? Emulator or Real device? – Lunch Basketball Dec 01 '21 at 02:20
  • @LunchBasketball TV real device (no probleme on emulator) – jug Dec 07 '21 at 13:57
  • Hi, I am Samsung TV WebRuntime engineer. Could you share me your sample wgt file to songdh418@gmail.com ? And let me know which Tizen version, you are testing. I will check. – DongHyun Song Dec 10 '21 at 09:27
  • And try like below 1) remove all CSP tag and allow-* tag. 2) modify tag as "" – DongHyun Song Dec 10 '21 at 09:33

0 Answers0