• We would like to invite you to check out the latest 1.0 alpha versions. You can read more about what's new here. Please note, that this is still an early release and will contain new bugs ¯\_(ツ)_/¯
  • If you need help or want to discuss things, you now can also join us on our Discord Server!

Bug: http.simpleRequest ignoriert headers

zALECz

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