HsacExamples.SlimTests.HttpTests.HttpPostFileTest


Contents:

We start a mock server to receive the binary file and display the request later (specify one response per request)


script mock xml server setup
add response
<status>OK</status>
add response
<status>OK</status>
add response
<status>OK</status>
add response
<status>OK</status>
$mockUrl<-[http://127.0.0.1:8000/FitNesseMock] get mock server url

Now we post files to the service. Note the different notation options. We can:


script http test
post file http://files/httpPostExamples/testFile.txt to $mockUrl->[http://127.0.0.1:8000/FitNesseMock]
post file files/httpPostExamples/testFile.txt to $mockUrl->[http://127.0.0.1:8000/FitNesseMock]
post file to $mockUrl->[http://127.0.0.1:8000/FitNesseMock]
post file files/httpPostExamples/test.png to $mockUrl->[http://127.0.0.1:8000/FitNesseMock]

The Message report will show the received request:

table: Mock Server Message Report
Expected and received 4 requests
1

request

--dF6LGopXASvbTt10YzETB8IKljY9OHRqQ_L Content-Disposition: form-data; name="file"; filename="testFile.txt" Content-Type: application/octet-stream Content-Transfer-Encoding: binary This file is used to test the posting of a binary data file to a webservice using HttpTest --dF6LGopXASvbTt10YzETB8IKljY9OHRqQ_L--

response

<status>OK</status>
2

request

--3M2oHftRb90V9qa4lmo4rEFPB8ZJaJT5Ssqdue Content-Disposition: form-data; name="file"; filename="testFile.txt" Content-Type: application/octet-stream Content-Transfer-Encoding: binary This file is used to test the posting of a binary data file to a webservice using HttpTest --3M2oHftRb90V9qa4lmo4rEFPB8ZJaJT5Ssqdue--

response

<status>OK</status>
3

request

--T1C5mi42MLEH-iBCAIutCq9c2EQ7a8actvN6qdmr Content-Disposition: form-data; name="file"; filename="test.png" Content-Type: application/octet-stream Content-Transfer-Encoding: binary �PNG  IHDRX2�$�:tEXtSoftwareAdobe ImageReadyq�e<UiTXtXML:com.adobe.xmp Tom Heintzberger TestFile �� ;PLTE���@I��!6���߮������Q�_����IDATx���� DI&��?���N�A���Piző#DCCCo��p?RŏPMh�L��d�ɡlw����;�L>a?�6�vp�`�R �1��"�fP�J,`h�+xi�H�S,��/tճ����� 84�͊����$��!�����5�<��p��^�v�1��'U��0�9�m#tK8#ހ�4���x�/b9��.��r\��$Q�wĵ�����ؒ<���q|u9/��=ϮZ���_�|\�\��kNw�

response

<status>OK</status>
4

request

--hQxBz2qhue1MlpeNka49PruBChSCmoC- Content-Disposition: form-data; name="file"; filename="test.png" Content-Type: application/octet-stream Content-Transfer-Encoding: binary �PNG  IHDRX2�$�:tEXtSoftwareAdobe ImageReadyq�e<UiTXtXML:com.adobe.xmp Tom Heintzberger TestFile �� ;PLTE���@I��!6���߮������Q�_����IDATx���� DI&��?���N�A���Piző#DCCCo��p?RŏPMh�L��d�ɡlw����;�L>a?�6�vp�`�R �1��"�fP�J,`h�+xi�H�S,��/tճ����� 84�͊����$��!�����5�<��p��^�v�1��'U��0�9�m#tK8#ހ�4���x�/b9��.��r\��$Q�wĵ�����ؒ<���q|u9/��=ϮZ���_�|\�\��kNw�

response

<status>OK</status>

Stop the mock server


script mock xml server setup
stop