Uploaded image for project: 'Spring Framework'
  1. Spring Framework
  2. SPR-17415

Cannot overwrite content-type response header with WebFlux

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 5.1.1
    • Fix Version/s: 5.1.2
    • Component/s: Reactive
    • Labels:
    • Last commented by a User:
      true

      Description

      I originally reported https://github.com/spring-projects/spring-boot/issues/13635 which Brian Clozel troubleshooted and transferred to SPR-17082 and then resolved. This resolved my original issue when I upgraded to Spring Boot 2.1.0.M4 (Spring 5.1.0.RELEASE).

      But when I upgraded to Spring Boot 2.1.0.RC1 (Spring 5.1.1.RELEASE), the issue came back. 

      Here is sample output in the original Spring Boot report and the example in SPR-17082 when using 2.1.0.M4/5.1.0.RELEASE:

      $ http localhost:8080/binary-test apiKey==bad
      HTTP/1.1 403 Forbidden
      Content-Length: 36
      Content-Type: application/json;charset=UTF-8
      
      {
          "developerMessage": "access denied"
      }
      
      
      $ http localhost:8080/test                   
      HTTP/1.1 400 Bad Request
      Content-Length: 32
      Content-Type: application/json
      
      {
          "field1": "test-error-response"
      }
      

       

      And here is exactly the same two calls when I only switch to 2.1.0.RC1/5.1.1.RELEASE:

      $ http localhost:8080/binary-test apiKey==bad
      HTTP/1.1 406 Not Acceptable
      Content-Length: 157
      Content-Type: application/json;charset=UTF-8
      
      {
          "error": "Not Acceptable",
          "message": "Could not find acceptable representation",
          "path": "/binary-test",
          "status": 406,
          "timestamp": "2018-10-19T23:33:58.349+0000"
      }
      
      $ http localhost:8080/test                   
      HTTP/1.1 400 Bad Request
      Content-Length: 32
      Content-Type: text/plain;charset=UTF-8
      Content-Type: application/json
      
      
      http: error: LookupError: unknown encoding: UTF-8, application/json
      

       

       

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              bclozel Brian Clozel
              Reporter:
              pluttrell Peter Luttrell
              Last updater:
              Spring Issuemaster
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Days since last comment:
                1 year, 37 weeks ago