UNPKG

967 BJavaScriptView Raw
1/*
2 * Copyright 2012-2014 the original author or authors
3 * @license MIT, see LICENSE.txt for details
4 *
5 * @author Scott Andrews
6 */
7
8(function (define) {
9 'use strict';
10
11 define(function (require) {
12
13 var interceptor;
14
15 interceptor = require('../interceptor');
16
17 if (typeof console !== 'undefined') {
18 console.log('rest.js: rest/interceptor/entity is deprecated, please use response.entity() instead');
19 }
20
21 /**
22 * @deprecated use response.entity() instead
23 *
24 * Returns the response entity as the response, discarding other response
25 * properties.
26 *
27 * @param {Client} [client] client to wrap
28 *
29 * @returns {Client}
30 */
31 return interceptor({
32 response: function (response) {
33 if ('entity' in response) {
34 return response.entity;
35 }
36 return response;
37 }
38 });
39
40 });
41
42}(
43 typeof define === 'function' && define.amd ? define : function (factory) { module.exports = factory(require); }
44 // Boilerplate for AMD and Node
45));