Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GQLgen test client to work with multipart form data (take 2) #1661

Merged
merged 8 commits into from
Oct 15, 2021

Commits on Oct 15, 2021

  1. Update GQLgen test client to work with multipart form data

    Update the GQLgen to support multipart form data, like those present
    within the fileupload examples.
    
    - Add missing space between "unsupported encoding " and failing
      content-type header error
    
    (cherry picked from commit 101842f)
    Sonna committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    92eb97d View commit details
    Browse the repository at this point in the history
  2. Add WithFiles client option for fileupload GQLgen client tests

    Add a `WithFiles` GQLgen client option to support the fileupload input
    within tests, using the core Golang `os` package and File type, which
    converts `os.File`s to their appropriate multipart form data within a
    request.
    
    - If there are no files this should just simply convert a
      `application/json` Content-Type to supported `multipart/form-data`
    
    (cherry picked from commit 08ef942)
    Sonna committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    550c512 View commit details
    Browse the repository at this point in the history
  3. Update fileupload test to use GQLgen test client

    Update the fileupload test to use the GQLgen test client and `WithFiles`
    option to remove the need for `createUploadRequest` helper with raw http
    posts
    
    - Fix setting the Content Type by using the appropriate `http` package
      function to dectect it
    
      + https://godoc.org/net/http#DetectContentType
    
    (cherry picked from commit 5e573d5)
    Sonna committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    ac4c3f6 View commit details
    Browse the repository at this point in the history
  4. Update WithFiles option test with multipart Reader

    (cherry picked from commit 6dfa3cb)
    Sonna committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    79e5a8e View commit details
    Browse the repository at this point in the history
  5. Update file upload tests WithFiles option

    Update the file upload tests to use the GQL test client and its
    `WithFiles` option to remove the need for a custom raw HTTP post request
    builder `createUploadRequest`.
    
    - Also update `WithFiles` option to group & map identical files; e.g.
    
      ```
        { "0": ["variables.req.0.file", "variables.req.1.file"] }
      ```
    
    (cherry picked from commit 486d9f1)
    Sonna committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    c10460b View commit details
    Browse the repository at this point in the history
  6. Make sure WithFiles does not add duplicates to multipart form data

    (cherry picked from commit 0c2364d)
    Sonna committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    ddb69c7 View commit details
    Browse the repository at this point in the history
  7. Fix use of byte vs string in WithFiles tests

    (cherry picked from commit ba10b5b)
    Sonna committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    27f3e11 View commit details
    Browse the repository at this point in the history
  8. Fix strict withFiles option test for race conditions

    Fix a problem with how strict the test's expected response was for tests
    with files in their request, since it always expected a strict order of
    files input that is somewhat random or dependent on what OS it is
    running the test on and/or race condition
    Sonna committed Oct 15, 2021
    Configuration menu
    Copy the full SHA
    f157b66 View commit details
    Browse the repository at this point in the history