Welcome! Log In Create A New Profile

Advanced

Re: NJS Questions and/or Bugs

Sergey A. Osokin
August 11, 2021 09:52PM
Hi Lance,

hope you're doing well.

On Wed, Aug 11, 2021 at 07:43:12PM -0500, Lance Dockins wrote:
> We’ve been experimenting with NJS in its current form (as compared
> with the more established LuaJIT integration provided by OpenResty)
> and it’s surfaced a series of questions about objects and features
> in NJS that the documentation, examples, recordings, and 3rd party
> examples don’t seem to answer very well.  I’m not sure if those
> should be asked here or in another division of Nginx but I wanted
> to lay them out.
>
> Request Data
>
> • Is there already an NJS object or are there plans for an object
> that parses and maps POST key/value pairs into a JSON object?

It's already implemented, here's an example of code:

var jObj = JSON.stringify(r.args);

> • Is there already an NJS object or are there plans for an object
> that parses out the cookies into key/value pairs of a JSON object?

Incoming headers of a request are represented in r.headersIn read-only
object, so it's possible to implement some additional logic, like the
following one:

for (var h in r.headersIn) {
// where:
// h is the header's name of a request
// r.headersIn[h] is the header's value
}

Hope that helps.

--
Sergey Osokin
_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

NJS Questions and/or Bugs

Lance Dockins August 11, 2021 08:44PM

Re: NJS Questions and/or Bugs

Sergey A. Osokin August 11, 2021 09:52PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 10:06PM

Re: NJS Questions and/or Bugs

Sergey A. Osokin August 11, 2021 10:22PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 10:32PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 10:40PM

Re: NJS Questions and/or Bugs

Sergey A. Osokin August 11, 2021 10:44PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 10:50PM

Re: NJS Questions and/or Bugs

Sergey A. Osokin August 11, 2021 10:58PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 11:02PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 11:46PM

Re: NJS Questions and/or Bugs

Lance Dockins August 11, 2021 11:52PM

Re: NJS Questions and/or Bugs

Sergey A. Osokin August 11, 2021 10:42PM

Re: NJS Questions and/or Bugs

Dmitry Volyntsev August 12, 2021 02:16AM

Re: NJS Questions and/or Bugs

Lance Dockins August 12, 2021 08:40AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 173
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready