gaurishhs / elysia-ip

Get Client IP Address in Elysia
MIT License
50 stars 10 forks source link

Usage with POST request #6

Closed mboisvertdupras closed 5 months ago

mboisvertdupras commented 7 months ago

It seems like the IP isn't included on the request object for a POST request.

{
  request: Request (0 KB) {
    method: "POST",
    url: "http://localhost:3000/get-quote",
    headers: Headers {
      "host": "localhost:3000",
      "connection": "keep-alive",
      "content-length": "138",
      "content-type": "multipart/form-data; boundary=----WebKitFormBoundarycWgoyItEDfYxlrDK",
      "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
      "accept": "*/*",
      "origin": "http://localhost:3000",
      "sec-fetch-mode": "cors",
      "sec-fetch-dest": "empty",
      "referer": "http://localhost:3000/",
      "accept-encoding": "gzip, deflate, br",
      "accept-language": "en-US,en-GB;q=0.9,en;q=0.8,fr-CA;q=0.7,fr;q=0.6",
      "sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
      "x-alpine-request": "true",
      "sec-ch-ua-mobile": "?0",
      "x-alpine-target": "quote",
      "sec-ch-ua-platform": "\"macOS\"",
      "sec-fetch-site": "same-origin",
    }
  },
  store: {},
  qi: -1,
  path: "/get-quote",
  set: {
    headers: {},
    status: 200,
  },
  headers: {
    host: "localhost:3000",
    connection: "keep-alive",
    "content-length": "138",
    "content-type": "multipart/form-data; boundary=----WebKitFormBoundarycWgoyItEDfYxlrDK",
    "user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36",
    accept: "*/*",
    origin: "http://localhost:3000",
    "sec-fetch-mode": "cors",
    "sec-fetch-dest": "empty",
    referer: "http://localhost:3000/",
    "accept-encoding": "gzip, deflate, br",
    "accept-language": "en-US,en-GB;q=0.9,en;q=0.8,fr-CA;q=0.7,fr;q=0.6",
    "sec-ch-ua": "\"Not_A Brand\";v=\"8\", \"Chromium\";v=\"120\", \"Google Chrome\";v=\"120\"",
    "x-alpine-request": "true",
    "sec-ch-ua-mobile": "?0",
    "x-alpine-target": "quote",
    "sec-ch-ua-platform": "\"macOS\"",
    "sec-fetch-site": "same-origin",
  },
  query: {},
  body: {
    testing: "",
  },
  ip: null,
  html: [Function: html],
  stream: [Function: stream],
}

Is this something that's possible to do?

gaurishhs commented 7 months ago

I am aware of this. https://github.com/elysiajs/elysia/issues/377#issuecomment-1899397749 As of now, I don't think so i can do anything on my end to resolve this.

gaurishhs commented 5 months ago

Issue resolved in Elysia version 1