Skip to content
This repository has been archived by the owner on Jan 15, 2021. It is now read-only.

Inject Glimpse Scripts Without Razor Dependency #77

Open
nikmd23 opened this issue Oct 19, 2015 · 2 comments
Open

Inject Glimpse Scripts Without Razor Dependency #77

nikmd23 opened this issue Oct 19, 2015 · 2 comments
Milestone

Comments

@nikmd23
Copy link
Member

nikmd23 commented Oct 19, 2015

For ASP.NET5 users who aren't using Razor, we may want to provide a solution that automatically injects the Glimpse script tabs via a wrapper around the response stream.

The following considerations need to be taken into account:

  • if the content length has been set and the response has started (which we can check) then we WONT want to modify the response,
  • if the content length has been set and the response has not started then we can inject the script and update the content length,
  • if they are running “in app” compression (i.e. via middleware) we should be able to look to see if the corresponding header has been set and not write to the stream,
  • if they are leveraging the server to do the compression, we are good just to write to the stream
  • any other time out side of these cases we should be good to write to the stream. All of this assuming content type is HTML
  • If the request is AJAX, then we don’t want to write to the stream.
  • Technically if the response doesn’t have a tag, then we don’t want to write to it either, but that case may be covered by the AJAX logic above.
  • If the doctype if XHTML, we shouldn’t be injecting either. This would break API’s that use this doctype. Technically, that content should be served with the content type of application/xhtml+xml.
@nikmd23 nikmd23 added this to the 2015.10.30 - 5 milestone Oct 19, 2015
@emyann
Copy link

emyann commented Nov 30, 2015

Hi @nikmd23 , I would like to know if you have already started to address this issue / enhancement of the GlimpseAgentMiddleware ?
I've just installed the 2.0.0-beta1 version along with aspnet5-1.0.0-rc1 and the client works like a charm on a web api ! That would be great if we could have the HUD directly injected in the page when we browse api responses or HTML's static pages.
I searched through sources a way to plug a middleware as you described but I find it better to ask you some informations before starting anything.
Thank you, let me know if I can help !

@nikmd23
Copy link
Member Author

nikmd23 commented Nov 30, 2015

Hi @emyann!

Thanks for showing interest in contributing to Glimpse.

We have not started this work. We have a similar idea in Glimpse v1 that might serve as a starting point.

As far as where this would be implemented in Glimpse v2, I would think we'd start by looking at GlimpseAgentMiddleware.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants