Skip to content
This repository has been archived by the owner on Jun 30, 2020. It is now read-only.

Filter list of acceptable headers; use default if the client accepts everything #81

Merged
merged 6 commits into from
Aug 22, 2017

Commits on Aug 15, 2017

  1. Added a priorities member variable, which allows the dev to filter th…

    …e list of acceptable headers.
    
    getFromHeader will return null if the accept header is either missing, or set to accept everything. This will allow the default to be used instead.
    mark-lambley-simpro committed Aug 15, 2017
    Configuration menu
    Copy the full SHA
    453e7f8 View commit details
    Browse the repository at this point in the history
  2. Updated README.md

    mark-lambley-simpro committed Aug 15, 2017
    Configuration menu
    Copy the full SHA
    cb89641 View commit details
    Browse the repository at this point in the history

Commits on Aug 16, 2017

  1. Configuration menu
    Copy the full SHA
    2d4cdf9 View commit details
    Browse the repository at this point in the history

Commits on Aug 17, 2017

  1. Changed the constructor param to be the actual formats, not the prior…

    …ities.
    
    Remove the priorities member variable and functionality.
    mark-lambley-simpro committed Aug 17, 2017
    Configuration menu
    Copy the full SHA
    e3b5a04 View commit details
    Browse the repository at this point in the history
  2. Code formatting.

    mark-lambley-simpro committed Aug 17, 2017
    Configuration menu
    Copy the full SHA
    53cf245 View commit details
    Browse the repository at this point in the history

Commits on Aug 22, 2017

  1. Default format is set to the first item in the list of formats. There…

    …fore we no longer need to check for "all" in getFromHeader.
    
    If the user explicitly sets default format to be null, then the system will generate a 406 Not Acceptable response if no types match. For example:
    
    ```
    //Code
    Middleware::FormatNegotiator([
        'json' => [['json'], ['application/json', 'text/json', 'application/x-json']],
        'zip' => [['zip'], ['application/zip', 'application/x-zip', 'application/x-zip-compressed']]
    ])
    ->defaultFormat(null)
    
    //Header:
    Accept: application/pdf
    
    //Result
    406 Not Acceptable
    ```
    
    Readme updated to reflect.
    mark-lambley-simpro committed Aug 22, 2017
    Configuration menu
    Copy the full SHA
    c349979 View commit details
    Browse the repository at this point in the history