Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add jsonp middleware for mock #8

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

feat: add jsonp middleware for mock #8

wants to merge 3 commits into from

Conversation

soda-x
Copy link
Contributor

@soda-x soda-x commented Jul 16, 2015

feat: add jsonp middleware for mock

@sorrycc
Copy link
Member

sorrycc commented Jul 16, 2015

应该也要能从 package.json 的 spm.server.jsonp 中获取配置,这样多人协作的时候就不需要每个人都加 --jsonp 参数了。

@soda-x
Copy link
Contributor Author

soda-x commented Jul 17, 2015

@sorrycc 好 我补充下

@@ -36,6 +37,10 @@ function Server(compiler, opts) {

var app = this.app = koa();

// support jsonp
if(opts.jsonp || opts.pkg.spm.jsonp) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

放在 server 里? 另外,opts.pkg.spm.jsonp 要做兼容,pkg 和 spm 都有可能不存在。

request(app.listen())
.get('/x.json')
.expect(function(res){
if(res.text.should.be.eql('{\n "hello": "world"\n}\n') === 0) throw new Error('Can not get right json content');
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

res.text.should.be.eql(...) 不就行了么,不用自己抛出异常吧?

@hotoo
Copy link
Member

hotoo commented Sep 6, 2015

能否说明下这个的场景,为什么不是默认支持?

@soda-x
Copy link
Contributor Author

soda-x commented Sep 11, 2015

@hotoo

场景出现在本地调试 .

是不是默认支持 @sorrycc 怎么看

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.

None yet

3 participants