Skip to content

Commit

Permalink
fixed default method of get bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnyshao committed May 20, 2019
1 parent d13ee2d commit 6301b32
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 23 deletions.
16 changes: 0 additions & 16 deletions exmaple/miniprogram_npm/wefetch/index.js

This file was deleted.

1 change: 0 additions & 1 deletion exmaple/miniprogram_npm/wefetch/index.js.map

This file was deleted.

3 changes: 2 additions & 1 deletion exmaple/pages/index/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
const { get, post, postJson, head, download} = require('../../api/index.js')
const wf = require('../../api/wf.js')
const wf = require('wefetch')

wf.defaults.baseUrl = 'http://localhost:3000'
wf.before.use(req => {
return req
})
wf.postJson('/postJson')
wf.get('/get', { data: { title: '标题' },header:{title: 'this is a title'} })
//获取应用实例
const app = getApp()
Expand Down
3 changes: 2 additions & 1 deletion src/lib/core/addMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import platform from "./platform";
['options', 'get', 'head', 'post', 'put', 'delete', 'trace', 'connect', 'postJson'].forEach(function (method) {
WeFetch.prototype[method] = function (url, config) {
return this.request(utils.merge(config || {}, {
url: url
url: url,
method: method
}))
}
});
Expand Down
5 changes: 3 additions & 2 deletions wefetch/dist/wefetch.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/*
Promise based wx.request api for Mini Program
@Github https://github.com/jonnyshao/wechat-fetch
wefetch beta v1.2.5 |(c) 2018-2019 By Jonny Shao
wefetch beta v1.2.6 |(c) 2018-2019 By Jonny Shao
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
Expand Down Expand Up @@ -280,7 +280,8 @@
['options', 'get', 'head', 'post', 'put', 'delete', 'trace', 'connect', 'postJson'].forEach(function (method) {
WeFetch.prototype[method] = function (url, config) {
return this.request(utils.merge(config || {}, {
url: url
url: url,
method: method
}))
};
});
Expand Down
Loading

0 comments on commit 6301b32

Please sign in to comment.