Fix nil error for GET requests

This commit is contained in:
Maximilian 2023-07-26 13:09:01 -05:00
parent d0085ab2c3
commit b475da66da

View File

@ -15,7 +15,8 @@ func SendRequest(url string, method string, headers map[string]string, body inte
var contentType string var contentType string
switch v := body.(type) { switch v := body.(type) {
case nil: // Leave nil for GET requests case nil:
reqBody = bytes.NewBuffer([]byte(""))
case map[string]string: case map[string]string:
reqBody = &bytes.Buffer{} reqBody = &bytes.Buffer{}
writer := multipart.NewWriter(reqBody) writer := multipart.NewWriter(reqBody)