1. 22 9月, 2015 3 次提交
    • A
      stop calling deprecated methods · e4ba720c
      Aaron Patterson 提交于
      We should be asking the mime type method for the mime objects rather
      than via const lookup
      e4ba720c
    • A
      deprecate accessing mime types via constants · efc6dd55
      Aaron Patterson 提交于
      We don't want to manage a list of constants on `Mime::`.  Managing
      constants is strange because it will break method caches, not to mention
      looking up by a constant could cause troubles.  For example suppose
      there is a top level constant `HTML`, but nobody registers the HTML mime
      type and someone accesses `Mime::HTML`.  Instead of getting an error
      about how the mime type doesn't exist, instead you'll get the top level
      constant.
      
      So, instead of directly accessing the constants, change this:
      
        Mime::HTML
      
      To this:
      
        Mime::Type[:HTML]
      efc6dd55
    • A
      cache the new type object on the stack · ad1d0b84
      Aaron Patterson 提交于
      Now we don't have to look it up with a `const_get`.
      ad1d0b84
  2. 21 9月, 2015 2 次提交
  3. 19 9月, 2015 14 次提交
  4. 18 9月, 2015 1 次提交
  5. 16 9月, 2015 1 次提交
  6. 15 9月, 2015 8 次提交
  7. 14 9月, 2015 1 次提交
  8. 11 9月, 2015 1 次提交
  9. 09 9月, 2015 9 次提交
    • E
      Update documentation to reflect Rack::Session::Abstract changes · b3ab44f6
      eileencodes 提交于
      `Rack::Session::Abstract::ID` is now deprecated and
      `Rack::Session::Abstract::Persisted` should be used instead.
      b3ab44f6
    • E
      Handle Content-Types that are not :json, :xml, or :url_encoded_form · 43d7a03a
      eileencodes 提交于
      In c546a2b0 this was changed to mimic how the browser behaves in a real
      situation but left out types that were registered.
      
      When this was changed it didn't take `text/plain` or `text/html` content
      types into account. This is a problem if you're manipulating the
      `Content-Type` headers in your controller tests, and expect a certain
      result.
      
      The reason I changed this to use `to_sym` is because if the
      `Content-Type` is not registered then the symbol will not exist. If it's
      one of the special types we handle that specifically (:json, :xml, or
      :url_encoded_form). If it's any registered type we handle it by setting
      the `path_parameters` and then the `request_parameters`. If the `to_sym`
      returns nil an error will be thrown.
      
      If the controller test sets a `Content-Type` on the request that `Content-Type`
      should remain in the header and pass along the filename.
      
      For example:
      If a test sets a content type on a post
      ```
      @request.headers['CONTENT_TYPE'] = 'text/plain'
      post :create, params: { name: 'foo.txt' }
      ```
      
      Then `foo.txt` should be in the `request_parameters` and params related
      to the path should be in the `path_parameters` and the `Content-Type`
      header should match the one set in the `@request`. When c546a2b0 was
      committed `text/plain` and `text/html` types were throwing a "Unknown
      Content-Type" error which is misleading and incorrect.
      
      Note: this does not affect how this is handled in the browser, just how
      the controller tests handle setting `Content-Type`.
      43d7a03a
    • A
    • A
      mime_type will always return a string · a27bb774
      Aaron Patterson 提交于
      a27bb774
    • A
      remove `parse_content_type` parameter · c10efc83
      Aaron Patterson 提交于
      This method is specifically about the content type so lets remove the
      parameter.
      c10efc83
    • A
      avoid allocations when there is no content type set · 376cccbd
      Aaron Patterson 提交于
      create a singleton content type that just has nils, so that we don't
      have to allocate a content type object all the time.
      376cccbd
    • A
      handle implicit rendering correctly · 8301969d
      Aaron Patterson 提交于
      If someone sets just a charset, but depends on the implicit type from
      rendering, this will store a strange content type header that looks like
      this:  `; charset=blah`.  This is so that when the content type header
      is parsed again, it will return nil for the actual type.
      8301969d
    • A
      remove mime type lookups when parsing the content type · bf8b22b3
      Aaron Patterson 提交于
      It turns out that the response object never really cares what the mime
      type object is, so just use the string.
      bf8b22b3
    • A
      refactor content type setting · 31b3294d
      Aaron Patterson 提交于
      pull content-type setting to a private method to dry it up.
      31b3294d