dyne / restroom-mw

🛠 Easy REST API builder executing Zencode
https://restroom.dyne.org
GNU Affero General Public License v3.0
3 stars 11 forks source link

feat: ✨ Pass http request to zencode script #223

Closed albertolerda closed 1 year ago

albertolerda commented 1 year ago

Each zencode script receive as input a http request of the form

{
  http_request: {
    base_url: '/api/http_request',
    headers: {
      'accept-encoding': 'gzip, deflate',
      connection: 'close',
      'content-length': '0',
      host: '127.0.0.1:44267'
    },
    http_version: '1.1',
    method: 'POST',
    path: '/',
    protocol: 'http',
    socket: {
      local_address: '::ffff:127.0.0.1',
      local_port: 44267,
      remote_address: '::ffff:127.0.0.1',
      remote_family: 'IPv6',
      remote_port: 59794
    }
  },
}

If http_request exists in data, it gets overwritten.

Important: EACH contract receives the data as above, thus Given nothing canno be used inside restroom