• If you need help or want to discuss things, you now can also join us on our Discord Server!
  • A first preview of the unlimited version of SinusBot can be found in the Upcoming Changes thread. A version for Windows will follow, but we don't have a release date, yet.

Bug: http.simpleRequest ignoriert headers

Alec7r

Member
Hallo liebes SinusBot-Team,

Beim Scripten ist mir aufgefallen, dass die http.simpleRequest-Funktion die Header die man mitgibt ignoriert und den Request ohne sie abschickt.

Mein Request
JavaScript:
var http = require('http');

http.simpleRequest({
    method: 'PATCH',
    url: 'https://***.de',
    debug: true,
    timeout: 10 * 1000,
    body: JSON.stringify({
        data: {
            title: track.title(),
            artist: track.artist(),
            album: track.album(),
            thumbail: track.thumbnail()
        }
    }),
    headers: {
        'Content-Type': 'application/json'
    }
}, function (error, response) {
    // on error
    if (error) {
        engine.log('Error: ', error);
        return;
    }
    // on http error
    if (response.statusCode != 200) {
        engine.log('HTTP Error: ', response.status);
        return;
    }
    // on success
    engine.log('Success: ', response);
});

Instance-Log
PATCH /update HTTP/1.1 Host: ***.de User-Agent: Go-http-client/1.1 Content-Length: 182 Accept-Encoding: gzip {"data":{"album":"Inception (Music From The Motion Picture)","artist":"Hans Zimmer","thumbail":"867486035962841bb5244bd4384516cc31ae6dc3c6bbb93973e75f4a444df05f.jpg","title":"Time"}}

Beim Empfänger
JSON:
{}


Ich hab das Problem umgehen, indem ich das http.simpleRequest durch sinusbot.http ersetzt habe.

neuer Instance-Log
PATCH /update HTTP/1.1 Host: ***.de User-Agent: SinusBot/0.14.3-0e747fd Content-Length: 211 Content-Type: application/json Accept-Encoding: gzip {"data":{"album":"The Elder Scrolls V: Skyrim: Original Game Soundtrack","artist":"Jeremy Soule","thumbail":"8f7c2150a764bd7ef19542eee66bcc3af90d08612297751dd913d9c9332f46e3.jpg","title":"From Past to Present"}}

Mit freundlichen Grüßen
zALECz
 
Last edited:
Top