@onehat/data 1.21.17 → 1.21.18

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,6 +2,7 @@ import { OneHatData } from '../../../src/OneHatData.js';
2
2
  import UsersDefinition from '../../fixtures/Definitions/Users.js';
3
3
  import GroupsDefinition from '../../fixtures/Definitions/Groups.js';
4
4
  import UserData from '../../fixtures/Data/User.js';
5
+ import _ from 'lodash';
5
6
 
6
7
  const baseURL = Cypress.env('baseURL'),
7
8
  creds = {
@@ -63,6 +64,22 @@ describe('OneBuildRepository', function() {
63
64
  expect(p.conditions.key2).to.be.eq('2');
64
65
  });
65
66
 
67
+ it('merge from lodash', function() {
68
+ const
69
+ a = {
70
+ test: true,
71
+ },
72
+ b = {
73
+ foo: true,
74
+ };
75
+ let c;
76
+ const bar = _.merge({}, a, b, c);
77
+
78
+ expect(_.isEqual(a, { test: true })).to.be.true;
79
+ expect(_.isEqual(b, { foo: true })).to.be.true;
80
+ expect(_.isEqual(bar, { test: true, foo: true })).to.be.true;
81
+ });
82
+
66
83
  it.skip('401', function() {
67
84
  cy.wrap((async () => {
68
85
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@onehat/data",
3
- "version": "1.21.17",
3
+ "version": "1.21.18",
4
4
  "description": "JS data modeling package with adapters for many storage mediums.",
5
5
  "main": "src/index.js",
6
6
  "type": "module",
@@ -96,7 +96,7 @@ class OneBuildRepository extends AjaxRepository {
96
96
  * Fires off axios request to server
97
97
  * @private
98
98
  */
99
- _send(method, url, data) {
99
+ _send(method, url, data, headers) {
100
100
 
101
101
  if (!url) {
102
102
  this.throwError('No url submitted');
@@ -108,17 +108,17 @@ class OneBuildRepository extends AjaxRepository {
108
108
  return;
109
109
  }
110
110
 
111
- const headers = _.merge({
111
+ const mergedHeaders = _.merge({
112
112
  // 'Content-Type': 'application/json', // Stops axios from using 'application/x-www-form-urlencoded'
113
113
  Accept: 'application/json',
114
- }, this.headers);
114
+ }, this.headers, headers);
115
115
 
116
116
  const options = {
117
117
  url,
118
118
  method,
119
119
  baseURL: this.api.baseURL,
120
120
  transformResponse: null,
121
- headers,
121
+ headers: mergedHeaders,
122
122
  params: method === 'GET' ? data : null,
123
123
  data: method !== 'GET' ? qs.stringify(data) : null,
124
124
  timeout: this.timeout,