Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JavaScript API: German umlaut in response header leads to conversion error #2162

Closed
ghost opened this issue Jul 6, 2021 · 1 comment
Closed

Comments

@ghost
Copy link

ghost commented Jul 6, 2021

Accessing a ressource via JavaScript http module leads to the following error if the response header contains a german umlaut like "äüö" or special characters like "ß":
Uncaught (in promise) failed to execute API: failed to convert response header value to string

Example:

Server

const express = require('express');
const cors = require('cors');
const app = express();
app.use(cors());

app.use(express.static('public'));

app.get('/test', (req, res) => {
    res.set("test-header", "ü")
    res.json({
        message: 'Hello World'
    });
});

app.get('/', (req, res) => {
    res.sendFile("index.html");
});

app.listen(2020, () => {
    console.log('server is listening on port 2020');
});
Client

const { http } = window.__TAURI__;

(async () => {
    const response = await http.fetch("http://localhost:2020/test", {
        method: "GET",
        responseType: 1,
    });

    console.log(response);
})();

tauri info:

Operating System - Windows, version 10.0.19043 X64
Webview2 - 91.0.864.64

Node.js environment
  Node.js - 14.15.1
  @tauri-apps/cli - 1.0.0-beta.5
  @tauri-apps/api - 1.0.0-beta.4

Global packages
  npm - 6.14.13
  yarn - Not installed

Rust environment
  rustc - 1.52.1
  cargo - 1.52.0

App directory structure
/node_modules
/public
/src-tauri

App
  tauri.rs - 1.0.0-beta.4
  build-type - bundle
  CSP - default-src blob: data: filesystem: ws: wss: http: https: tauri: 'unsafe-eval' 'unsafe-inline' 'self' img-src: 'self'
  distDir - public
  devPath - http://localhost:2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant