Skip to content

Conversation

@max-mapper
Copy link

hi jason

@jhs
Copy link
Member

jhs commented Sep 16, 2011

Hi, Max. I had notifications going to the wrong email address and only now saw this. Is it sill good to merge? Thanks.

@jhs
Copy link
Member

jhs commented Sep 16, 2011

Another question: Is there a way to implement this feature that is more parallel (or ideally identical) to the request API? For example, maybe {"json":"true} in the options?

cf

What do you think? Thanks.

@max-mapper
Copy link
Author

It'd be great if we could support both the request DSL and also the jQuery DSL somehow

@jhs
Copy link
Member

jhs commented Sep 16, 2011

The goal is code portability so I'm afraid of people writing browser request code which wouldn't then work on Node (or wherever else request is ever ported).

One thing request.jquery already does is extend request, such as request.json and request.couch. To me, it is @mikeal's request that is falling behind our code! Maybe that is a distinction without a difference, but at least if you call request.couch in Node you get fail-early, rather than unexpected behavior upon reply.

Based on my understanding of your problem, these would be my priorities to solve it:

  1. Support request's {"jsonp":true} semantics
  2. Make this project's request.json do the right thing and tell people use that for jsonp
  3. Add a request.jsonp method which Mikeal can re-implement at his leisure
  4. Your patch (no offense! Feel free to challenge my aesthetic judgements here)

@max-mapper
Copy link
Author

in light of your responses supporting the jQuery DSL doesn't make much practical sense so I'll abandon that idea

however, implementing jsonp in node isn't possible nor does it apply to server side javascript. Can we automatically try jsonp if the request origin doesn't match the current origin and the user has specified json: true?

@jhs
Copy link
Member

jhs commented Sep 18, 2011

Maybe my typo was misleading, option 1 should say support request's {"json":true} semantics.

request.jquery is already hard-coding a CORS request (xhrFields and crossDomain) options.

I am having difficulty thinking of a way to detect "json":true and then decide whether to do JSONP or CORS. Still thinking.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants