Hello there,
Reading [ns_getform] documentation, I noticed it supports multipart/form-data
https://naviserver.sourceforge.io/n/naviserver/files/ns_getform.html
<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
set myform [ns_getform]
if {[string equal "" $myform]} {
ns_log Notice "No Form was submited"
} else {
ns_log Notice "FORM"
ns_set print $myform
for {set i 0} {$i < [ns_set size $myform]} {incr i} {
set varname [ns_set key $myform $i]
set varvalue [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 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
[email protected]
https://lists.sourceforge.net/lists/listinfo/naviserver-devel