[ 
https://issues.apache.org/jira/browse/WW-4558?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15147671#comment-15147671
 ] 

ASF GitHub Bot commented on WW-4558:
------------------------------------

Github user victorsosa commented on a diff in the pull request:

    https://github.com/apache/struts/pull/87#discussion_r52929566
  
    --- Diff: 
plugins/json/src/main/java/org/apache/struts2/json/JSONInterceptor.java ---
    @@ -70,17 +70,22 @@
         private boolean noCache = false;
         private boolean excludeNullProperties;
         private String callbackParameter;
    -    private String contentType;
    +    private String accept;
     
         @SuppressWarnings("unchecked")
         public String intercept(ActionInvocation invocation) throws Exception {
             HttpServletRequest request = ServletActionContext.getRequest();
             HttpServletResponse response = ServletActionContext.getResponse();
    -        String contentType = request.getHeader("content-type");
    -        if (contentType != null) {
    +        
    +        //parameter wasn't set by the interceptor
    +        if (accept == null) {
    +            accept = request.getHeader("accept");
    +        }
    +        
    +        if (accept != null) {
    --- End diff --
    
    This can be remove, it is not needed anymore, we are using accept parameter


> contentType override ignored for JSONInterceptor
> ------------------------------------------------
>
>                 Key: WW-4558
>                 URL: https://issues.apache.org/jira/browse/WW-4558
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Plugin - JSON
>    Affects Versions: 2.3.24
>            Reporter: Jasper Rosenberg
>            Priority: Minor
>             Fix For: 2.3.25
>
>
> JSONInterceptor takes a contentType parameter, but as far as I can tell does 
> nothing with it.  I would think a reasonable way to use it would be to have 
> it used if available, rather than the content type from the request so that 
> the interceptor can be used when receiving a JSON post from a third party 
> that does not set the correct content type.
> PR https://github.com/apache/struts/pull/87



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to