Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: metacpan/metacpan-client
base: a9d794f1b8a5
Choose a base ref
...
head repository: metacpan/metacpan-client
compare: c0ea92800fcf
Choose a head ref
  • 9 commits
  • 7 files changed
  • 2 contributors

Commits on Aug 13, 2014

  1. Request.pm: Isolate generated 'ua' from user provided 'ua'.

    By default, the value of 'ua' should be generated by MetaCPAN::Client,
    and used **only** by MetaCPAN::Client, and Search::Elasticsearch should
    be left to produce its own one.
    
    However, if the user specifies a 'ua', then that 'ua' should be used for
    both MetaCPAN::Client and Search::Elasticsearch.
    
    Allowing users to specify their own 'ua' has risks of breaking things,
    such as not injecting the right headers by default, so it is users
    responsibility to get that part right.
    
    Likewise, when we're using Search::Elasticsearch without needing any
    'ua' customization, we should let it create its own one, which is more
    likely to be "correct"
    
    Implementation choices:
    
      previously; ->new( ua => )  mapped to ua =
          and ->ua returns that value verbatim.
    
      now: ->new( ua =>  ) maps to _user_ua
          and ->ua still returns that value verbatim.
    
    However, the fact '_user_ua' is merely a predicate means we can later
    do:
    
      my %cfg = (
           ...
      );
      if ( $self->_user_ua ) {
        cfg{handle} = $self->_user_ua;
      }
      Search::Elasticsearch->new( %cfg );
    
    Wheras that wouldn't work with a pure 'ua', because 'has_ua' would
    return true as soon as it had ever been lazy-built.
    kentfredric committed Aug 13, 2014
    Copy the full SHA
    58b4774 View commit details
    Browse the repository at this point in the history
  2. Copy the full SHA
    74fe420 View commit details
    Browse the repository at this point in the history
  3. Role::Entity.pm: Add an optional, lazy loaded 'client' attribute.

    This allows clients to create objects that remember who created them,
    and thus allow created objects to call subsequent requests sharing the
    Clients configuration options. ( Especially in regard to UA )
    
    If no such attribute is passed, the it will be created on demand when
    needed.
    
    This will make existing code continue to function even if it doesn't use
    the MetaCPAN Client base directly.
    kentfredric committed Aug 13, 2014
    Copy the full SHA
    8a39f07 View commit details
    Browse the repository at this point in the history
  4. Copy the full SHA
    6f529b1 View commit details
    Browse the repository at this point in the history
  5. Copy the full SHA
    a529708 View commit details
    Browse the repository at this point in the history
  6. t/ua_trap.t: Add a basic bad-ua-passing test that fails due to ES cal…

    …ling HTTP::Tiny directly
    
    This presently fails on the existing MetaCPAN::Client but is fixed in
    the pull request containing this test.
    kentfredric committed Aug 13, 2014
    Copy the full SHA
    c6635d7 View commit details
    Browse the repository at this point in the history
  7. Copy the full SHA
    21a5695 View commit details
    Browse the repository at this point in the history
  8. Copy the full SHA
    b8707db View commit details
    Browse the repository at this point in the history

Commits on Aug 14, 2014

  1. Merge pull request #17 from kentfredric/master

    Retain 'ua' when user specified wherever possible.
    mickeyn committed Aug 14, 2014
    Copy the full SHA
    c0ea928 View commit details
    Browse the repository at this point in the history