summaryrefslogtreecommitdiffstats
path: root/other-licenses/nsis/Contrib/HttpPostFile/test/postdriver.nsi
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /other-licenses/nsis/Contrib/HttpPostFile/test/postdriver.nsi
parentInitial commit. (diff)
downloadfirefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz
firefox-26a029d407be480d791972afb5975cf62c9360a6.zip
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'other-licenses/nsis/Contrib/HttpPostFile/test/postdriver.nsi')
-rw-r--r--other-licenses/nsis/Contrib/HttpPostFile/test/postdriver.nsi63
1 files changed, 63 insertions, 0 deletions
diff --git a/other-licenses/nsis/Contrib/HttpPostFile/test/postdriver.nsi b/other-licenses/nsis/Contrib/HttpPostFile/test/postdriver.nsi
new file mode 100644
index 0000000000..6a54bf3ca3
--- /dev/null
+++ b/other-licenses/nsis/Contrib/HttpPostFile/test/postdriver.nsi
@@ -0,0 +1,63 @@
+; Any copyright is dedicated to the Public Domain.
+; http://creativecommons.org/publicdomain/zero/1.0/
+
+; Simple driver for HttpPostFile, passes command line args to HttpPostFile::Post and
+; writes the result string to a file for automated checking.
+; Always specifies Content-Type: application/json
+;
+; Usage: posttest /postfile=postfile.json /url=http://example.com /resultfile=result.txt
+
+!include LogicLib.nsh
+!include FileFunc.nsh
+
+OutFile "postdriver.exe"
+RequestExecutionLevel user
+ShowInstDetails show
+Unicode true
+
+!addplugindir ..\..\..\Plugins
+
+Var PostFileArg
+Var UrlArg
+Var ResultFileArg
+Var ResultString
+
+Section
+
+StrCpy $ResultString "error getting command line arguments"
+
+ClearErrors
+${GetParameters} $0
+IfErrors done
+
+ClearErrors
+${GetOptions} " $0" " /postfile=" $PostFileArg
+IfErrors done
+
+${GetOptions} " $0" " /url=" $UrlArg
+IfErrors done
+
+${GetOptions} " $0" " /resultfile=" $ResultFileArg
+IfErrors done
+
+DetailPrint "POST File = $PostFileArg"
+DetailPrint "URL = $UrlArg"
+DetailPrint "Result File = $ResultFileArg"
+
+StrCpy $ResultString "error running plugin"
+HttpPostFile::Post $PostFileArg "Content-Type: application/json$\r$\n" $UrlArg
+Pop $ResultString
+
+done:
+${If} $ResultString != "success"
+DetailPrint $ResultString
+${EndIf}
+
+ClearErrors
+FileOpen $0 $ResultFileArg "w"
+${Unless} ${Errors}
+FileWrite $0 $ResultString
+FileClose $0
+${EndUnless}
+
+SectionEnd