Maybe, we should add "self-healing" to the feature list of NaviServer :)

In general, it is a good idea to make test-cases with curl, also for you to understand, what is going on in detail.

all the best

-gn

On 04.07.20 18:37, Iuri de Araujo Sampaio wrote:
Hi,
I woke up today and Postman requests work fine now. I have no clue what the error was, and I have done nothing to fix it.

Well, I added a log message in the first line, before calling [ns_getform], but that would no affect the problem. Maybe the stars were playing with me last night. Or it was a cache refreshing delay. Who knows? kkkkk

ns_log Notice "CTree $cTree  ****"

Best wishes,
I


On Jul 4, 2020, at 00:25, Iuri de Araujo Sampaio <i...@iurix.com <mailto:i...@iurix.com>> wrote:

Hello there,

Reading [ns_getform] documentation, I noticed it supports multipart/form-data
https://naviserver.sourceforge.io/n/naviserver/files/ns_getform.html

However, when I run the chunk bellow, it shows no form, neither fields and values at all, in the GET request.

I’ve written [ns_getcontent …] right bellow the chunk, confirming that the body of the request has content within it, plus in the proper format (i.e. multipart/form-data).

Furthermore, if I switch the request to /application/x-www-form-urlencoded/the chunk works just fine and form fields are properly assigned. Thus, I’m lost!

Could it be that Postman uses a different format for form-data? (Thus, it isn’t supported by ns_getform.)

Logs are bellow.

Best wishes.
I


setmyform[ns_getform]
if{[stringequal ""$myform]} {
        ns_log Notice "No Form was submited"
    } else{
        ns_log Notice "FORM"
        ns_set print $myform
for{seti 0} {$i< [ns_set size $myform]} {incri} {
setvarname[ns_set key $myform$i]
setvarvalue[ns_set value $myform$i]

ns_log Notice " $varname - $varvalue"
        }
    }

    ns_log Notice "BODY \n [ns_getcontent -as_file false]”





[04/Jul/2020:00:07:19][8773.7efbf2d6e700][-conn:iurix:1:1031-] Notice: HEADER
 t0
[04/Jul/2020:00:07:19][8773.7efbf2d6e700][-conn:iurix:1:1031-] Notice: HEADERS 11 [04/Jul/2020:00:07:19][8773.7efbf2d6e700][-conn:iurix:1:1031-] Notice: Host iurix.com <http://iurix.com/> X-Real-IP 179.199.203.207 Connection close Content-Length 386 authorization {Bearer eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eydzdWInOiAnNTk0MycsICdpYXQnOiAxNTkzODI2NjQ0fQ==.20f471933ae0a9c58d525f4ab0c1eef7adab03f17c3bbe18a00cf30a1ef06948} User-Agent PostmanRuntime/7.25.0 Accept */* Cache-Control no-cache Postman-Token 93e1f2b8-b680-470f-be60-52a25c93db0a Content-Type {multipart/form-data; boundary=--------------------------973675580213918217977892} Cookie ad_session_id=\"35550042%2c0%2c0%2c1593831987%20{947%201593833187%20876F0016C8883111AC63B5C6B6D964D76ED2D1DF}\" [04/Jul/2020:00:07:19][8773.7efbf2d6e700][-conn:iurix:1:1031-] Notice: FORM [04/Jul/2020:00:07:19][8773.7efbf2d6e700][-conn:iurix:1:1031-] Notice: BODY
----------------------------973675580213918217977892
Content-Disposition: form-data; name="cTree"

featured
----------------------------973675580213918217977892
Content-Disposition: form-data; name="cTreeName"

t
----------------------------973675580213918217977892
Content-Disposition: form-data; name="cTreeIcon"

t
----------------------------973675580213918217977892--

[04/Jul/2020:00:07:19][8773.7efbf2d6e700][-conn:iurix:1:1031-] Notice: TREE [04/Jul/2020:00:07:19][8773.7efbf2d6e700][-conn:iurix:1:1031-] Notice: cTree
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net <mailto:naviserver-devel@lists.sourceforge.net>
https://lists.sourceforge.net/lists/listinfo/naviserver-devel



_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel
_______________________________________________
naviserver-devel mailing list
naviserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/naviserver-devel

Reply via email to