{
   "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
   "id": "540593",
   "self": "https://bugs.mojang.com/rest/api/2/issue/540593",
   "key": "BDS-18627",
   "fields": {
      "issuetype": "1",
      "project": "11700",
      "fixVersions": [],
      "resolution": "4",
      "customfield_10500": {
         "self": "https://bugs.mojang.com/rest/api/2/customFieldOption/10300",
         "value": "Unconfirmed",
         "id": "10300",
         "disabled": false
      },
      "customfield_12800": null,
      "customfield_12602": [],
      "customfield_12601": null,
      "customfield_12604": null,
      "customfield_12603": null,
      "customfield_12606": null,
      "customfield_12605": null,
      "customfield_12608": null,
      "resolutiondate": "2024-05-14T19:14:11.000+0300",
      "customfield_12607": null,
      "customfield_12609": null,
      "workratio": -1,
      "lastViewed": null,
      "watches": {
         "self": "https://bugs.mojang.com/rest/api/2/issue/BDS-18627/watchers",
         "watchCount": 0,
         "isWatching": false
      },
      "created": "2023-08-07T22:11:35.000+0300",
      "customfield_12000": null,
      "customfield_12201": null,
      "customfield_12600": null,
      "labels": [],
      "customfield_11700": "{}",
      "versions": [
         "21534"
      ],
      "issuelinks": [],
      "assignee": null,
      "updated": "2024-05-14T19:14:11.000+0300",
      "status": "5",
      "description": "*See comment: this is only a difference between how Windows and Linux handle GET requests.*\r\n\r\nRunning a BDS server on Linux Ubuntu 20.04.6 LTS, utilizing the gametest @minecraft/server-net.HttpRequest method, and noticing that headers and request payloads are not sent from BDS on Linux while they are sent from BDS on Windows. Both client and server code is the same, and I can confirm that requests are reaching the server from the BDS client on both platforms.\r\n\r\nRunning netcat on Linux shows the following:\r\n\r\n\u00a0\r\n{noformat}\r\nGET /write_state HTTP/1.1\r\nHost: 127.0.0.1:8888\r\nAccept: */*\r\nUser-Agent: libhttpclient/1.0.0.0{noformat}\r\nWhile running ncat on Windows shows the following:\r\n\r\n\u00a0\r\n\r\n\u00a0\r\n{noformat}\r\nGET /update HTTP/1.1\r\nConnection: Keep-Alive\r\nUser-Agent: libhttpclient/1.0.0.0\r\nContent-Length: 53\r\nHost: 127.0.0.1:8888\r\n\r\n{\"time\":5000,\"weather\":0,\"entities\":{},\"messages\":[]}{noformat}\r\nNote the content length header and the payload (both requests should have a payload).\r\n\r\n\u00a0\r\n\r\nCode sample:\r\n\r\n\u00a0\r\n{code:java}\r\n\u00a0 const req = new mcnet.HttpRequest(HOST + endpoint);\r\n\u00a0 req.setTimeout(0.5);\r\n\u00a0 if (body !== undefined) req.setBody(body);\r\n\u00a0 if (headers !== undefined) {\r\n\u00a0 \u00a0 const headerObjs: mcnet.HttpHeader[] = [];\r\n\u00a0 \u00a0 for (const [k, v] of Object.entries(headers)) {\r\n\u00a0 \u00a0 \u00a0 headerObjs.push(new mcnet.HttpHeader(k, v));\r\n\u00a0 \u00a0 }\r\n\u00a0 \u00a0 req.setHeaders(headerObjs);\r\n\u00a0 }\r\n\u00a0 let res;\r\n\u00a0 try {\r\n\u00a0 \u00a0 res = await mcnet.http.request(req);\r\n\u00a0 } catch(e) {\r\n\u00a0 \u00a0 console.error('Invalid request: ', e);\r\n\u00a0 \u00a0 return;\r\n\u00a0 }{code}\r\nLet me know if there is anything that would help narrow this down. Thanks!\r\n\r\n\u00a0",
      "customfield_11100": 0.0,
      "customfield_11300": "Linux",
      "customfield_11500": null,
      "customfield_12503": null,
      "customfield_12700": "[Briefly describe the bug here]\r\n\r\n*Steps to Reproduce:*\r\n# [Step 1]\r\n# [Step 2]\r\n# [Step 3]\r\n\r\n*Observed Results:*\r\n[Describe what happens]\r\n\r\n*Expected Results:*\r\n[Describe what should happen]\r\n\r\n*Screenshots/Videos attached:* [please attach an image or short video]\r\n\r\n*Notes:*",
      "customfield_12502": null,
      "customfield_12504": null,
      "attachment": [],
      "summary": "[Script API] Headers/Body not set on BDS GET HttpRequest calls on Linux, but is on Windows",
      "creator": "JIRAUSER550892",
      "reporter": "JIRAUSER550892",
      "customfield_10002": null,
      "customfield_12501": null,
      "customfield_12500": null,
      "customfield_11601": null,
      "customfield_11600": "0|i2emtb:",
      "environment": null,
      "customfield_11801": null,
      "customfield_11800": null,
      "customfield_11602": null,
      "customfield_11802": null,
      "comment": {
         "comments": [
            {
               "self": "https://bugs.mojang.com/rest/api/2/issue/540593/comment/1273716",
               "id": "1273716",
               "author": "JIRAUSER550892",
               "body": "Updated title to reflect the more accurate case: this is only a difference on GET requests on Linux vs Windows.\u00a0\r\n\r\nTest Code used:\r\n{code:javascript}\r\nimport * as mc from \"@minecraft/server\";\r\nimport * as mcnet from \"@minecraft/server-net\";\r\n\r\nasync function timeout(ticks: number) {\r\n  return await new Promise<void>(res => {\r\n    mc.system.runTimeout(res, ticks);\r\n  });\r\n}\r\n\r\nasync function testMsg() {\r\n  async function sendReq(method: mcnet.HttpRequestMethod) {\r\n    const req = new mcnet.HttpRequest('http://httpbin.org/anything');\r\n    req.setHeaders([new mcnet.HttpHeader('X-Custom', 'foo')]);\r\n    req.setBody('Test test test.')\r\n    req.setMethod(method)\r\n    const res = await mcnet.http.request(req);\r\n    console.log('Status:', res.status)\r\n    console.log('Headers:', JSON.stringify(res.headers.map(h => [h.key, h.value])));\r\n    console.log('Body:', res.body);\r\n    console.log('.');\r\n    console.log('.');\r\n    console.log('.');\r\n  }\r\n  await sendReq(mcnet.HttpRequestMethod.Get);\r\n  await timeout(60);\r\n  await sendReq(mcnet.HttpRequestMethod.Post);\r\n  await timeout(60);\r\n  await sendReq(mcnet.HttpRequestMethod.Put);\r\n  await timeout(60);\r\n  await sendReq(mcnet.HttpRequestMethod.Delete);\r\n}\r\n\r\ntestMsg();\r\n{code}\r\nPost, Delete, and Put all behaved identically.\r\n\r\nResponse (Windows) (note the data field with \"Test test test\"):\r\n{noformat}\r\n[2023-08-07 14:21:09:246 WARN] Web response body of unsupported content-type 'application/json' is being treated as 'text/plain'\r\n[2023-08-07 14:21:09:280 INFO] [Scripting] Status: 200\r\n\r\n[2023-08-07 14:21:09:282 INFO] [Scripting] Headers: [[\"access-control-allow-origin\",\"*\"],[\"access-control-allow-credentials\",\"true\"],[\"date\",\"Mon, 07 Aug 2023 21:21:08 GMT\"],[\"connection\",\"keep-alive\"],[\"content-type\",\"application/json\"],[\"content-length\",\"398\"],[\"server\",\"gunicorn/19.9.0\"]]\r\n\r\n[2023-08-07 14:21:09:285 INFO] [Scripting] Body: {\r\n  \"args\": {},\r\n  \"data\": \"Test test test.\",\r\n  \"files\": {},\r\n  \"form\": {},\r\n  \"headers\": {\r\n    \"Content-Length\": \"15\",\r\n    \"Host\": \"httpbin.org\",\r\n    \"User-Agent\": \"libhttpclient/1.0.0.0\",\r\n    \"X-Amzn-Trace-Id\": \"Root=1-64d16044-1c5754f16c0b822c13e4e88c\",\r\n    \"X-Custom\": \"foo\"\r\n  },\r\n  \"json\": null,\r\n  \"method\": \"GET\",\r\n  \"origin\": \"<REDACTED>\",\r\n  \"url\": \"http://httpbin.org/anything\"\r\n}\r\n\r\n{noformat}\r\nResponse Linux (note the empty data field):\r\n{noformat}\r\n[2023-08-07 21:40:31:341 WARN] Web response body of unsupported content-type 'application/json' is being treated as 'text/plain'\r\n[2023-08-07 21:40:31:376 INFO] [Scripting] Status: 200\r\n\r\n[2023-08-07 21:40:31:377 INFO] [Scripting] Headers: [[\"server\",\"gunicorn/19.9.0\"],[\"date\",\"Mon, 07 Aug 2023 21:40:31 GMT\"],[\"content-type\",\"application/json\"],[\"connection\",\"keep-alive\"],[\"content-length\",\"378\"],[\"access-control-allow-origin\",\"*\"],[\"access-control-allow-credentials\",\"true\"]]\r\n\r\n[2023-08-07 21:40:31:377 INFO] [Scripting] Body: {\r\n  \"args\": {},\r\n  \"data\": \"\",\r\n  \"files\": {},\r\n  \"form\": {},\r\n  \"headers\": {\r\n    \"Accept\": \"*/*\",\r\n    \"Host\": \"httpbin.org\",\r\n    \"User-Agent\": \"libhttpclient/1.0.0.0\",\r\n    \"X-Amzn-Trace-Id\": \"Root=1-64d164cf-488979347ad6527362eca3f5\",\r\n    \"X-Custom\": \"foo\"\r\n  },\r\n\"json\": null,\r\n\"method\": \"GET\",\r\n\"origin\": \"<REDACTED>\",\r\n\"url\": \"http://httpbin.org/anything\"\r\n}\r\n{noformat}\r\n\r\nExpected behavior here is that the two platforms should operate the same, either both allowing GET requests to have attached bodies, or for neither to allow bodies and to explicitly throw an exception when set.",
               "updateAuthor": "JIRAUSER550892",
               "created": "2023-08-08T00:53:37.841+0300",
               "updated": "2023-08-08T00:53:37.841+0300"
            },
            {
               "self": "https://bugs.mojang.com/rest/api/2/issue/540593/comment/1279896",
               "id": "1279896",
               "author": "JIRAUSER648376",
               "body": "Hi\r\n\r\nDoes this issue still occur after updating to 1.20.15? \r\n\r\nThis ticket will automatically reopen when you reply. ",
               "updateAuthor": "JIRAUSER648376",
               "created": "2023-09-15T13:07:08.263+0300",
               "updated": "2023-09-15T13:07:08.263+0300"
            },
            {
               "self": "https://bugs.mojang.com/rest/api/2/issue/540593/comment/1322834",
               "id": "1322834",
               "author": "JIRAUSER484247",
               "body": "Cleaning up old tickets: This ticket had been set to 'Awaiting Response', but has not received a response from the reporter (~3 months+) so is being closed as Incomplete. If you feel this is still a valid issue then please comment, or create a new ticket following the Issue Guidelines which includes steps to reproduce the problem.\r\n\r\nQuick Links:\r\n\ud83d\udcd3 Issue Guidelines \u2013 \ud83d\udcac Mojang Support \u2013 \ud83d\udce7 Suggestions \u2013 \ud83d\udcd6 Minecraft Wiki\r\n\r\n",
               "updateAuthor": "JIRAUSER484247",
               "created": "2024-05-14T19:14:11.312+0300",
               "updated": "2024-05-14T19:14:11.312+0300"
            }
         ],
         "maxResults": 3,
         "total": 3,
         "startAt": 0
      },
      "votes": {
         "self": "https://bugs.mojang.com/rest/api/2/issue/BDS-18627/votes",
         "votes": 1,
         "hasVoted": false
      }
   },
   "changelog": {
      "startAt": 0,
      "maxResults": 6,
      "total": 6,
      "histories": [
         {
            "id": "2848623",
            "author": "JIRAUSER550892",
            "created": "2023-08-08T00:47:04.053+0300",
            "items": [
               {
                  "field": "summary",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": "[Script API] Headers/Body not set on BDS HttpRequest calls on Linux",
                  "to": null,
                  "toString": "[Script API] Headers/Body not set on BDS GET HttpRequest calls on Linux, but is on Windows"
               }
            ]
         },
         {
            "id": "2848624",
            "author": "JIRAUSER550892",
            "created": "2023-08-08T00:54:13.915+0300",
            "items": [
               {
                  "field": "description",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": "Running a BDS server on Linux Ubuntu 20.04.6 LTS, utilizing the gametest @minecraft/server-net.HttpRequest method, and noticing that headers and request payloads are not sent from BDS on Linux while they are sent from BDS on Windows. Both client and server code is the same, and I can confirm that requests are reaching the server from the BDS client on both platforms.\r\n\r\nRunning netcat on Linux shows the following:\r\n\r\n\u00a0\r\n{noformat}\r\nGET /write_state HTTP/1.1\r\nHost: 127.0.0.1:8888\r\nAccept: */*\r\nUser-Agent: libhttpclient/1.0.0.0{noformat}\r\nWhile running ncat on Windows shows the following:\r\n\r\n\u00a0\r\n\r\n\u00a0\r\n{noformat}\r\nGET /update HTTP/1.1\r\nConnection: Keep-Alive\r\nUser-Agent: libhttpclient/1.0.0.0\r\nContent-Length: 53\r\nHost: 127.0.0.1:8888\r\n\r\n{\"time\":5000,\"weather\":0,\"entities\":{},\"messages\":[]}{noformat}\r\nNote the content length header and the payload (both requests should have a payload).\r\n\r\n\u00a0\r\n\r\nCode sample:\r\n\r\n\u00a0\r\n{code:java}\r\n\u00a0 const req = new mcnet.HttpRequest(HOST + endpoint);\r\n\u00a0 req.setTimeout(0.5);\r\n\u00a0 if (body !== undefined) req.setBody(body);\r\n\u00a0 if (headers !== undefined) {\r\n\u00a0 \u00a0 const headerObjs: mcnet.HttpHeader[] = [];\r\n\u00a0 \u00a0 for (const [k, v] of Object.entries(headers)) {\r\n\u00a0 \u00a0 \u00a0 headerObjs.push(new mcnet.HttpHeader(k, v));\r\n\u00a0 \u00a0 }\r\n\u00a0 \u00a0 req.setHeaders(headerObjs);\r\n\u00a0 }\r\n\u00a0 let res;\r\n\u00a0 try {\r\n\u00a0 \u00a0 res = await mcnet.http.request(req);\r\n\u00a0 } catch(e) {\r\n\u00a0 \u00a0 console.error('Invalid request: ', e);\r\n\u00a0 \u00a0 return;\r\n\u00a0 }{code}\r\nLet me know if there is anything that would help narrow this down. Thanks!\r\n\r\n\u00a0",
                  "to": null,
                  "toString": "*See comment: this is only a difference between how Windows and Linux handle GET requests.*\r\n\r\nRunning a BDS server on Linux Ubuntu 20.04.6 LTS, utilizing the gametest @minecraft/server-net.HttpRequest method, and noticing that headers and request payloads are not sent from BDS on Linux while they are sent from BDS on Windows. Both client and server code is the same, and I can confirm that requests are reaching the server from the BDS client on both platforms.\r\n\r\nRunning netcat on Linux shows the following:\r\n\r\n\u00a0\r\n{noformat}\r\nGET /write_state HTTP/1.1\r\nHost: 127.0.0.1:8888\r\nAccept: */*\r\nUser-Agent: libhttpclient/1.0.0.0{noformat}\r\nWhile running ncat on Windows shows the following:\r\n\r\n\u00a0\r\n\r\n\u00a0\r\n{noformat}\r\nGET /update HTTP/1.1\r\nConnection: Keep-Alive\r\nUser-Agent: libhttpclient/1.0.0.0\r\nContent-Length: 53\r\nHost: 127.0.0.1:8888\r\n\r\n{\"time\":5000,\"weather\":0,\"entities\":{},\"messages\":[]}{noformat}\r\nNote the content length header and the payload (both requests should have a payload).\r\n\r\n\u00a0\r\n\r\nCode sample:\r\n\r\n\u00a0\r\n{code:java}\r\n\u00a0 const req = new mcnet.HttpRequest(HOST + endpoint);\r\n\u00a0 req.setTimeout(0.5);\r\n\u00a0 if (body !== undefined) req.setBody(body);\r\n\u00a0 if (headers !== undefined) {\r\n\u00a0 \u00a0 const headerObjs: mcnet.HttpHeader[] = [];\r\n\u00a0 \u00a0 for (const [k, v] of Object.entries(headers)) {\r\n\u00a0 \u00a0 \u00a0 headerObjs.push(new mcnet.HttpHeader(k, v));\r\n\u00a0 \u00a0 }\r\n\u00a0 \u00a0 req.setHeaders(headerObjs);\r\n\u00a0 }\r\n\u00a0 let res;\r\n\u00a0 try {\r\n\u00a0 \u00a0 res = await mcnet.http.request(req);\r\n\u00a0 } catch(e) {\r\n\u00a0 \u00a0 console.error('Invalid request: ', e);\r\n\u00a0 \u00a0 return;\r\n\u00a0 }{code}\r\nLet me know if there is anything that would help narrow this down. Thanks!\r\n\r\n\u00a0"
               }
            ]
         },
         {
            "id": "2848814",
            "author": "umija5895",
            "created": "2023-08-08T14:57:09.523+0300",
            "items": [
               {
                  "field": "Key",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": "MCPE-174077",
                  "to": null,
                  "toString": "BDS-18627"
               },
               {
                  "field": "Platform",
                  "fieldtype": "custom",
                  "from": "11503",
                  "fromString": "Multiple",
                  "to": null,
                  "toString": ""
               },
               {
                  "field": "Version",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": null,
                  "to": "21534",
                  "toString": "1.20.12 Hotfix"
               },
               {
                  "field": "Version",
                  "fieldtype": "jira",
                  "from": "21541",
                  "fromString": "1.20.13 Hotfix",
                  "to": null,
                  "toString": null
               },
               {
                  "field": "Workflow",
                  "fieldtype": "jira",
                  "from": "713098",
                  "fromString": "MCPE Workflow",
                  "to": "713133",
                  "toString": "Global Mojang Workflow"
               },
               {
                  "field": "project",
                  "fieldtype": "jira",
                  "from": "10200",
                  "fromString": "Minecraft (Bedrock codebase)",
                  "to": "11700",
                  "toString": "Bedrock Dedicated Server"
               }
            ]
         },
         {
            "id": "2867281",
            "author": "JIRAUSER648376",
            "created": "2023-09-15T13:07:08.269+0300",
            "items": [
               {
                  "field": "resolution",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": null,
                  "to": "10001",
                  "toString": "Awaiting Response"
               },
               {
                  "field": "status",
                  "fieldtype": "jira",
                  "from": "1",
                  "fromString": "Open",
                  "to": "5",
                  "toString": "Resolved"
               }
            ]
         },
         {
            "id": "2994946",
            "author": "JIRAUSER484247",
            "created": "2024-05-14T18:51:44.112+0300",
            "items": [
               {
                  "field": "resolution",
                  "fieldtype": "jira",
                  "from": "10001",
                  "fromString": "Awaiting Response",
                  "to": null,
                  "toString": null
               },
               {
                  "field": "status",
                  "fieldtype": "jira",
                  "from": "5",
                  "fromString": "Resolved",
                  "to": "4",
                  "toString": "Reopened"
               }
            ]
         },
         {
            "id": "2995082",
            "author": "JIRAUSER484247",
            "created": "2024-05-14T19:14:11.314+0300",
            "items": [
               {
                  "field": "resolution",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": null,
                  "to": "4",
                  "toString": "Incomplete"
               },
               {
                  "field": "status",
                  "fieldtype": "jira",
                  "from": "4",
                  "fromString": "Reopened",
                  "to": "5",
                  "toString": "Resolved"
               }
            ]
         }
      ]
   }
}