Uploaded image for project: 'Infinispan'
  1. Infinispan
  2. ISPN-3770

Incorrect Content-Type header when putting object via REST and get with different Accept

    XMLWordPrintable

Details

    • Bug
    • Resolution: Won't Do
    • Major
    • None
    • None
    • Server
    • None

    Description

      When putting serialized object via REST post and then getting it back with different Accept header (for example application/json), the retrieved data has still the "creation-time" Content-Type and data doesn't change in any way.

      I would expect retrieving nice json structure for instace.

      Code snippet:

      public void testCustomObjectGetAcceptJSONAndXML() throws Exception{
              String fullPathKeyA = fullPathKey(KEY_A);
              TestSerializable object = new TestSerializable("CONTENT");
      
              ByteArrayOutputStream bout = new ByteArrayOutputStream();
              ObjectOutputStream oo = new ObjectOutputStream(bout);
              oo.writeObject(object);
              oo.flush();
              oo.close();
      
              byte[] byteData = bout.toByteArray();
              post(fullPathKeyA, byteData, "application/x-java-serialized-object");
      
      
              HttpResponse getJson = get(fullPathKeyA, null, HttpServletResponse.SC_OK, true, "Accept", "application/json");
              assertTrue(getJson.getHeaders("Content-type")[0].getValue().contains("application/json")); //this assertion fails
      
              HttpResponse getXml = get(fullPathKeyA, null, HttpServletResponse.SC_OK, true, "Accept", "application/xml");
              assertTrue(getXml.getHeaders("Content-type")[0].getValue().contains("application/xml")); //this assertion fails
          }  
      

      Attachments

        Activity

          People

            rh-ee-galder Galder Zamarreño
            jholusa Jiří Holuša (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: