Skip to content
This repository was archived by the owner on Dec 1, 2023. It is now read-only.

Commit 5115bcb

Browse files
committed
v0.1.15
1 parent 8c9308e commit 5115bcb

File tree

4 files changed

+24
-28
lines changed

4 files changed

+24
-28
lines changed

bower.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "vue-resource",
33
"main": "dist/vue-resource.js",
44
"description": "A web request service for Vue.js",
5-
"version": "0.1.14",
5+
"version": "0.1.15",
66
"homepage": "https://github.com/vuejs/vue-resource",
77
"license": "MIT",
88
"ignore": [

dist/vue-resource.js

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* vue-resource v0.1.14
2+
* vue-resource v0.1.15
33
* https://github.com/vuejs/vue-resource
44
* Released under the MIT License.
55
*/
@@ -211,11 +211,11 @@ return /******/ (function(modules) { // webpackBootstrap
211211
Url.options, this.options, options
212212
);
213213

214-
url = options.url.replace(/:([a-z]\w*)/gi, function (match, name) {
214+
url = options.url.replace(/(\/?):([a-z]\w*)/gi, function (match, slash, name) {
215215

216216
if (options.params[name]) {
217217
urlParams[name] = true;
218-
return encodeUriSegment(options.params[name]);
218+
return slash + encodeUriSegment(options.params[name]);
219219
}
220220

221221
return '';
@@ -225,9 +225,6 @@ return /******/ (function(modules) { // webpackBootstrap
225225
url = options.root + '/' + url;
226226
}
227227

228-
url = url.replace(/([^:])[\/]{2,}/g, '$1/');
229-
url = url.replace(/(\w+)\/+$/, '$1');
230-
231228
_.each(options.params, function (value, key) {
232229
if (!urlParams[key]) {
233230
queryParams[key] = value;
@@ -382,21 +379,21 @@ return /******/ (function(modules) { // webpackBootstrap
382379
options.crossOrigin = crossOrigin(options.url);
383380
}
384381

385-
options.method = options.method.toLowerCase();
382+
options.method = options.method.toUpperCase();
386383
options.headers = _.extend({}, Http.headers.common,
387384
!options.crossOrigin ? Http.headers.custom : {},
388-
Http.headers[options.method],
385+
Http.headers[options.method.toLowerCase()],
389386
options.headers
390387
);
391388

392-
if (_.isPlainObject(options.data) && /^(get|jsonp)$/i.test(options.method)) {
389+
if (_.isPlainObject(options.data) && /^(GET|JSONP)$/i.test(options.method)) {
393390
_.extend(options.params, options.data);
394391
delete options.data;
395392
}
396393

397-
if (options.emulateHTTP && !options.crossOrigin && /^(put|patch|delete)$/i.test(options.method)) {
394+
if (options.emulateHTTP && !options.crossOrigin && /^(PUT|PATCH|DELETE)$/i.test(options.method)) {
398395
options.headers['X-HTTP-Method-Override'] = options.method;
399-
options.method = 'post';
396+
options.method = 'POST';
400397
}
401398

402399
if (options.emulateJSON && _.isPlainObject(options.data)) {
@@ -412,7 +409,7 @@ return /******/ (function(modules) { // webpackBootstrap
412409
options.data = JSON.stringify(options.data);
413410
}
414411

415-
promise = (options.method == 'jsonp' ? jsonp : xhr).call(this.vm, _, options);
412+
promise = (options.method == 'JSONP' ? jsonp : xhr).call(this.vm, _, options);
416413
promise = extendPromise(promise.then(transformResponse, transformResponse), this.vm);
417414

418415
if (options.success) {
@@ -877,9 +874,9 @@ return /******/ (function(modules) { // webpackBootstrap
877874
case 3:
878875
case 2:
879876

880-
if (_.isFunction (args[1])) {
877+
if (_.isFunction(args[1])) {
881878

882-
if (_.isFunction (args[0])) {
879+
if (_.isFunction(args[0])) {
883880

884881
success = args[0];
885882
error = args[1];
@@ -901,9 +898,9 @@ return /******/ (function(modules) { // webpackBootstrap
901898

902899
case 1:
903900

904-
if (_.isFunction (args[0])) {
901+
if (_.isFunction(args[0])) {
905902
success = args[0];
906-
} else if (/^(post|put|patch)$/i.test(options.method)) {
903+
} else if (/^(POST|PUT|PATCH)$/i.test(options.method)) {
907904
data = args[0];
908905
} else {
909906
params = args[0];
@@ -920,9 +917,8 @@ return /******/ (function(modules) { // webpackBootstrap
920917
throw 'Expected up to 4 arguments [params, data, success, error], got ' + args.length + ' arguments';
921918
}
922919

923-
options.url = action.url;
924920
options.data = data;
925-
options.params = _.extend({}, action.params, params);
921+
options.params = _.extend({}, options.params, params);
926922

927923
if (success) {
928924
options.success = success;
@@ -937,12 +933,12 @@ return /******/ (function(modules) { // webpackBootstrap
937933

938934
Resource.actions = {
939935

940-
get: {method: 'get'},
941-
save: {method: 'post'},
942-
query: {method: 'get'},
943-
update: {method: 'put'},
944-
remove: {method: 'delete'},
945-
delete: {method: 'delete'}
936+
get: {method: 'GET'},
937+
save: {method: 'POST'},
938+
query: {method: 'GET'},
939+
update: {method: 'PUT'},
940+
remove: {method: 'DELETE'},
941+
delete: {method: 'DELETE'}
946942

947943
};
948944

0 commit comments

Comments
 (0)