winglang / wing

A programming language for the cloud ☁️ A unified programming model, combining infrastructure and runtime code into one language ⚡
https://winglang.io
Other
4.76k stars 187 forks source link

`cloud.ApiRequest.body` is an empty string for GET requests #6565

Open eladcon opened 1 month ago

eladcon commented 1 month ago

I tried this:

bring cloud;
bring http;

let api = new cloud.Api();
api.get("/", inflight (r) => {
  if let body = r.body {
    return {
      status: 500
    };
  } else {
    return {
      status: 200
    };
  }
});

test "" {
  let res = http.get(api.url);
  assert(res.status == 200);
}

This happened:

assertion failed: res.status == 200

I expected this:

No response

Is there a workaround?

No response

Anything else?

No response

Wing Version

No response

Node.js Version

No response

Platform(s)

No response

Community Notes

ekeren commented 1 month ago

+1

monadabot commented 1 month ago

Congrats! :rocket: This was released in Wing 0.74.20.

eladcon commented 4 days ago

It seems that AWS is treating both empty strings body and no body as the same - null body. Do we want to match this behavior? I'm not sure what's happening in other cloud providers.

staycoolcall911 commented 4 days ago

Since this is currently not blocking any user, I've lowered the priority to p3