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 documentation and refactor Rack::Test::Session #295

Merged
merged 6 commits into from
May 11, 2022

Commits on May 11, 2022

  1. Configuration menu
    Copy the full SHA
    62561d2 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    1899f07 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    f2cf108 View commit details
    Browse the repository at this point in the history
  4. Refactor and update documentation for Rack::Test::Session

    Metaprogram the HTTP verb methods to reduce duplication.
    
    Remove need for @headers instance variable, by having header
    method do the name mangling and storing the result in @env.
    In addition to being simpler, this is also faster as it
    avoids the need to mangling the names in every request.
    When mangling names, avoid unnecessary string allocations.
    Also remove the @default_host instance variable, since it
    was only used in one place.
    
    Avoid array allocation in follow_redirect!.  Also avoid
    unnecessary indirection by using custom_request directly.
    This will also fix cases where there is a redirect following
    a custom_request with an HTTP verb for which there is no
    method.
    
    Avoid unnecessary string allocation and method calls in
    parse_uri.
    
    Remove default_env and headers_for_env private methods.
    Both were only used in one place.  headers_for_env is
    no longer needed after the change to header, and
    default_env is simple enough to inline. Use a private
    frozen constant as the default environment.
    
    Remove inaccurate comments in env_for.  We decided not to
    remove support for :method, since it is still supported
    in Rack, and Rack::ContentLength has never dealt with
    Content-Length in requests, only Content-Length in
    responses. Remove unnecessary array allocations in
    env_for as well.
    
    Require forwardable, since it is used in this file,
    instead of relying on the fact that rack/test/methods
    currently requires forwardable.
    jeremyevans committed May 11, 2022
    Configuration menu
    Copy the full SHA
    c49ed1b View commit details
    Browse the repository at this point in the history
  5. Use lower case headers

    This is compatible with earlier versions of Rack, and lower-case
    headers are required in Rack 3.  Accessing the headers for the
    last response uses a case insensitive match.
    
    This also changes the headers used in multipart requests, for
    consistency, even though that is not required by the rack SPEC.
    
    While here, remove some bogus comments in the specs about
    Rack::ContentLength setting content length for requests.
    jeremyevans committed May 11, 2022
    Configuration menu
    Copy the full SHA
    21082f4 View commit details
    Browse the repository at this point in the history
  6. Rename variable

    jeremyevans committed May 11, 2022
    Configuration menu
    Copy the full SHA
    d260580 View commit details
    Browse the repository at this point in the history