Skip to content

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

@ghost

Description

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions