This error is happening in the core Trac package. Whom should I report to? 
Also I am using similar code in few other area. There it works well.

On Wednesday, March 4, 2020 at 1:58:46 PM UTC+5:30, Jun Omae wrote:
>
> That is due to Request.end_headers() called twice. Please report it to 
> the plugin maintainers. 
>
> On Wed, Mar 4, 2020 at 2:42 PM Velu Narasimman <[email protected] 
> <javascript:>> wrote: 
> > 
> > Hi team, 
> > 
> >     I am facing this "headers have already been sent" error in an AJAX 
> call. I am not able to fix it. I need your hellp. Would be better if 
> someone could explain this issue. 
> > 
> > 2020-03-04 11:00:45,582 Trac[main] ERROR: [172.24.188.116] Internal 
> Server Error: <RequestWithSession "POST '/admin/pros users/users'">, 
> referrer 'https://prism30.aspiresys.com/Merlin/admin/pros%20users/users' 
> > Traceback (most recent call last): 
> >   File 
> "/usr/local/lib/python2.7/dist-packages/Trac-1.0.15-py2.7.egg/trac/web/main.py",
>  
> line 631, in _dispatch_request 
> >     dispatcher.dispatch(req) 
> >   File 
> "/usr/local/lib/python2.7/dist-packages/Trac-1.0.15-py2.7.egg/trac/web/main.py",
>  
> line 325, in dispatch 
> >     req.send(output, content_type or 'text/html') 
> >   File 
> "/usr/local/lib/python2.7/dist-packages/Trac-1.0.15-py2.7.egg/trac/web/api.py",
>  
> line 556, in send 
> >     self.end_headers() 
> >   File 
> "/usr/local/lib/python2.7/dist-packages/Trac-1.0.15-py2.7.egg/trac/web/api.py",
>  
> line 476, in end_headers 
> >     self._write = self._start_response(self._status, self._outheaders) 
> > RuntimeError: headers have already been sent 
> > 
> > Above chunk is the error. And below is how I write my json response to 
> the AJAX call. 
> >     def respond(self, req, data, code=200): 
> >         """Respond to the JSON request by sending the JSON-encoded data 
> back.""" 
> >         json_data = json.dumps(data) 
> >         req.send_response(code) 
> >         req.send_header('Content-Type', 'application/json') 
> >         req.send_header('Content-Length', len(json_data)) 
> >         req.write(json_data) 
> >         raise RequestDone 
> > 
> > Not sure if I am missing any code here in this respond method. Welcome 
> your suggestions to fix this error. 
>
>
>
>
> -- 
> Jun Omae <[email protected] <javascript:>> (大前 潤) 
>

-- 
You received this message because you are subscribed to the Google Groups "Trac 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/trac-users/a6858f6d-fe2e-491b-ab23-f399fc2ebe2d%40googlegroups.com.

Reply via email to