Fuse Community

Network request failed on HTTPS

hi guys
any one found the solution to this problem
fetch data HTTPS Request not Working in my app but it’s work fine in Postman
fuse version 1.10

<App>
    <JavaScript>
    var Observable = require("FuseJS/Observable");
    var data = Observable();

    function Article(item) {
        this.number = item.number;
    };

    fetch("https://azureURL" )
    .then(function(response) { return response.json(); })
    .then(function(responseObject) {
        var items = [];
        responseObject.forEach(function(r) {
            items.push(new Article(r));
        });
        data.replaceAll(items);
        debug_log("data: " + JSON.stringify(data));
    }).catch(function(e) {
        console.log("Error: " + e.message);
    });

    module.exports = {
        dataSource: data
    };
    </JavaScript>
    <StackPanel Margin="16" ItemSpacing="16">
        <Each Items="{dataSource}">
            <Text Value="{number}" Alignment="Center" TextAlignment="Center" TextWrapping="Wrap" />
			
        </Each>
		
    </StackPanel>
</App>

HTTPS definitely works.

What’s the error that you get?

Have you tried these examples: https://fuseopen.com/docs/backend/rest-apis.html

1 Like

when get data in my local proxy it’s work fine
Capture3
but when change url to https:azure…net, not working and get this error
Capture4

Sounds like a network issue, can your device hit your local server from the web browser?

yes
my device hit my local server

Https works, see example below, so it must be your local server, possibly the DNS, try hitting your IP and port direct on your local WiFi.

<App>
    <JavaScript>
    var Observable = require("FuseJS/Observable");
    var data = Observable();

    function Article(item) {
        this.number = item.number;
    };

    fetch("https://jsonplaceholder.typicode.com/todos/1" )
    .then(function(response) { return response.json(); })
    .then(function(responseObject) {
        console.log(JSON.stringify(responseObject));
    }).catch(function(e) {
        console.log("Error: " + e.message);
    });

    module.exports = {
        dataSource: data
    };
    </JavaScript>
    <StackPanel Margin="16" ItemSpacing="16">
        <Each Items="{dataSource}">
            <Text Value="{number}" Alignment="Center" TextAlignment="Center" TextWrapping="Wrap" />
            
        </Each>
        
    </StackPanel>
</App>
1 Like