godotengine / godotengine/godot

HTTP post request does not send an empty string

Open
#116,404 1 comment 0 reactions 0 assignees View on GitHub
bug needs testing topic:network
Dominant language
C++
Stars
117k
Forks
26.8k
PR merge metrics
PR metrics pending

Description

### Tested versions

4.6.stable.mono (i dont think its a mono issue)

### System information

win10

### Issue description

Today something in my server changed so that I need to pass an empty string as the `request_data` in a http request. I thought that `request_data` in `HTTPRequest.request()` has an empty string by default, so it would just not declare it in code.

Turns out, that adding a space is able to trick the `request_data` to be empty and also passed by godot:
```swift
http_login.request(
url,
[HEADERS],
HTTPClient.METHOD_POST,
" ", # adding a space - " " instead of ""
```

If I don't do this I get 400 errors on the server I'm requesting from. I noticed that this may be unintended behaviour with godots requests so I am reporting it!

### Steps to reproduce

Other software is required to test the endpoints, so an MRP might not work.

### Minimal reproduction project (MRP)

see above

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.