0

I need to create a performance test for Nuget repository using Jmeter tool and I need to deploy/upload .nupkg files to the repository however I have a problem with uploading. I receive error number 415 - Unsupported media type. Seems like something wrong with a Content-Type or with multipart/form-data transmission which has to be used for upload. The Jmeter has such option for POST but I have PUT in my case.

The curl below publishes properly

curl -XPUT http://hostname/api/nuget/nuget/ -u login:password -F "package=@/home/nugetFiles/shay-1-test.2.1.0.nupkg"

I have unsuccessfully tried the following - added file path in the Files Upload tab in the HTTP request sampler, added HTTP Header Manager as a child and tried the upload uing several variants with different Content-Types via HTTP Header Manager item.

  • application/x-nupkg;
  • application/octet-stream;
  • multipart/form-data; boundary="6aec860d-8c85-4cea-854e-a051e77873c4";

and Content-Disposition value

  • Content-Disposition: form-data; name=package; filename=package.nupkg; filename*=utf-8''package.nupkg

HTTP header manager also has X-NuGet-ApiKey value

I also found out that the file should be added to the request body however I do not know how to do it.

Please help.

Sergey Konotop
  • 121
  • 1
  • 13

2 Answers2

0

Just record your upload request.

  1. Copy shay-1-test.2.1.0.nupkg to "bin" folder of your JMeter installation
  2. Configure JMeter for recording. The easiest way is using JMeter Templates feature

    • from JMeter's main menu choose File -> Templates -> Recording and click "Create"
  3. Open HTTP(S) Test Script Recorder and click "Start"
  4. Execute your CURL request through JMeter's proxu like:

    curl -x http://localhost:8888 -XPUT http://hostname/api/nuget/nuget/ -u login:password -F "package=@/home/nugetFiles/shay-1-test.2.1.0.nupkg"
    
  5. That should be it, the recorded request will live under Thread Group -> Recording Controller.
Dmitri T
  • 159,985
  • 5
  • 83
  • 133
  • Hello, I have recorded curl request and Nuget cli client's request. I suppose the recorder skip something important. The problem in the main description is related to the already recorded scenarios. – Sergey Konotop May 22 '18 at 06:21
0

The root cause it the following - I'm using Jmeter 3.3, the latest released version is 4.0. According to this bug multipart/form-data transmission which is necessary for NuGet client - does not work in Jmeter for PUT method.

I have checked a stable trunk Jmeter version (apache-jmeter-r1831500.zip) has taken from here and was able to deploy Nuget package.

As a workaround it's possible to create a test via OS Process Sampler using bash commands.

Thanks everybody for help.

Sergey Konotop
  • 121
  • 1
  • 13