ctakahashi / rest-client

Automatically exported from code.google.com/p/rest-client
Apache License 2.0
0 stars 0 forks source link

Options for syntax highlighting on long response bodies. #117

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Receive XML content > 200KB
2.
3.

What is the expected output? What do you see instead?
With syntax highlighting set to "None", display is instantaneous.
With syntax highlighting set to "XML", display take > 40 seconds.
On longer responses, RESTClient must be shut down and restarted.

What version of the product are you using? On what operating system?
2.3.0 and 2.3.2 on Windows XP

Please provide any additional information below.

I am interacting with a web service that provides content in XML,
although I would imagine the following also applies to JSON-based
services.

When receiving short responses from the web service the syntax
highlighting feature is helpful and welcome.  Unfortunately, at times
I will make a request that results in a large XML response and, in
those instances RESTClient will become unresponsive for a long period
of time trying to perform the syntax highlight.  (I have "Auto-indent
Response Body" turned off in the options, so that is not the problem.)

This usually results in having to force-quit RESTClient and starting
a new instance.  I then have to make some other request that provides
a short response so I can right-click on the Response - Body tab and
select Syntax Color = None.  I can then repeat the query with the long
response and evaluate it.  (Syntax highlighting is always "on" by 
default when starting the application.)

Generally, I am not interested in working with the entire response
when it is very long; I just want to see that it looks as expected.

I will propose several ways to address this, any of which would be
acceptable.

1. An option to set the default syntax highlight or a check box to
force it to be "None".

2. A button or keystroke to cancel an ongoing syntax highlighting
operation that is taking too long.

3. A button to perform a one-time syntax highlight even when syntax
highlighting is set to "None".  (This would simply lower the desire to
have syntax highlighting set to an automatic value in the first place.
Not very elegant and implies that option 1 exists also.)

4. An option to limit the size of the response body displayed.  The
rest of the response would be simply discarded.  This would mask
issues with syntax highlighting, but may not be acceptable in all
situations.  The user would have to be sure to turn off syntax
highlighting when turning off the "response size limit" option or what
occurs now would happen again.

5. The nicest solution would be to just avoid syntax highlighting when
the content exceeds a reasonable size.  If highlighting happens
internally after the entire response is received, the size should be
easy to determine.  If it happens as the response is being received,
it could key off of the Content-Length header.  Obviously, a missing
Content-Length header or the presence of a header like
Transfer-Encoding = chunked, would result in the highlighting being
off unless the user forces it to happen after the response is
received.

Bug or enhancement?  The combination of not being able to shut of
syntax highlighting until after the first request and the inability to
regain control of the application once it has begun, dooms usage when
the first request of a session results in a long response.  So that
makes me lean toward "bug".  However, I would not disagree with this
being classified as an enhancement either. 

Thank you,
Steve

Original issue reported on code.google.com by shma...@gmail.com on 3 Sep 2010 at 3:59

GoogleCodeExporter commented 8 years ago
Thanks @Steve for reporting the issue and suggesting alternatives. Will think 
about the possibilities.

Original comment by subwiz on 5 Sep 2010 at 1:58

GoogleCodeExporter commented 8 years ago
r478 has the fix. Syntax coloring can be enabled/disabled from the 
Tools>Options>Etc. dialog. Requires restart of RESTClient for taking effect.

Original comment by subwiz on 7 Sep 2010 at 6:02