Javascript That Downloads Javascript #3

localnerve opened this Issue Sep 14, 2013 · 5 comments


None yet

2 participants

First of all, thank you for making this middleware. It's great for injecting content into responses.
In my case, I've run into some trouble. I have a javascript file that downloads more javascript (via Require.js). My tests show that when this happens, the inner js download does not get written. Content-type is undefined and no response content is written.
I've been trying to see what the root cause is, but so far, I'm only finding that, for the inner js download, Write never gets called (only End, with no args). However, I can see that both connect-injector and static respond to the request, and static send is called (which pipes to res).
This happens whether my responses are intercepted or not (tried both).
The outer js file is large enough that it requires two chunks.
In my middleware stack, I have connect-injector (first), then static (only those 2). If I remove connect-injector from the stack, all js downloads properly, so I've been concentrating my efforts on the connect-injector code.

Any ideas or suggestions you might have about my situation are greatly appreciated,

daffl commented Sep 14, 2013

Do you have a minimum breaking example? It shouldn't change anything on the files besides what you are injecting.

I created this repo that exactly reproduces the problem and allows for testing:

Again, any ideas or suggestions you might have about the situation are greatly appreciated.

daffl commented Sep 16, 2013

Thanks for reproducing this. I ran into occasional problems with the browsers not loading content but wasn't able to track it down. Maybe this will help to pinpoint the problem. I will have a look into it.

@daffl daffl referenced this issue Sep 17, 2013

Injector rewritten #6

@daffl daffl closed this in 90dfe73 Sep 17, 2013
daffl commented Sep 17, 2013

I just pushed a new release which should fix your issue (at least I didn't run into it anymore).

Incredible! Thank You!!!

On Tue, Sep 17, 2013 at 1:25 AM, David Luecke notifications@github.comwrote:

I just pushed a new release which should fix your issue (at least I didn't
run into it anymore).

Reply to this email directly or view it on GitHub

Alex Grant
LocalNerve, LLC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment