Uploaded image for project: 'Dev - Nexus Repo'
  1. Dev - Nexus Repo
  2. NEXUS-17919

Swagger generated curl command for POST /v1/components can be incorrect

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 3.13.0
    • Fix Version/s: 3.15.0
    • Component/s: REST
    • Environment:
    • Story Points:
      1
    • Release Note:
      Yes

      Description

      1. Using the API Swagger interface for POST /v1/components, Try it Out by entering the following information:

      repository: nuget-hosted

      nuget.asset: Choose a valid nuget package off your local file system.

      2. Execute the call

      3. The call should be successful. The problem is the example curl command generated is wrong:

      curl -X POST "http://localhost:8081/service/rest/v1/components?repository=nuget-hosted" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "nuget.asset=@nugethello.1.0.3.nupkg;type="

       

      Executing this results in an error, even if you correct the file location and add the user/password:

       

      curl -u admin:admin123 -X POST "http://localhost:8081/service/rest/v1/components?repository=nuget-hosted" -H "accept: application/json" -H "Content-Type: multipart/form-data" -F "nuget.asset=@/Users/plynch/dev/tmp/nuget/nugethello.1.0.3.nupkg;type="
      
      Warning: Illegally formatted content-type field!
      
      curl: option -F: is badly used here
      
      curl: try 'curl --help' or 'curl --manual' for more information

       

      The correct command would be:

       

      curl -u admin:admin123 -F "nuget.asset=@/Users/plynch/dev/tmp/nuget/nugethello.1.0.3.nupkg" "http://localhost:8081/service/rest/beta/components?repository=nuget-hosted"

        Attachments

          Activity

            People

            Assignee:
            mbucher Michael Bucher
            Reporter:
            plynch Peter Lynch
            Last Updated By:
            Peter Lynch Peter Lynch
            Team:
            NXRM - Morpheus
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Date of First Response:

                tigCommentSecurity.panel-title