DATAREST-1077 - HAL Browser: Pass request headers in ALL requests
Pass headers from HAL.client on requests so custom request headers aren't lost. E.g. custom Authorization: bearer <token> headers
This commit is contained in:
@@ -6,8 +6,9 @@
|
||||
* Links have to be set via a PUT operation with the proper media type.
|
||||
*
|
||||
* @author Greg Turnquist
|
||||
* @author Gregory Frank
|
||||
* @since 2.4
|
||||
* @see DATAREST-627
|
||||
* @see DATAREST-627, DATAREST-1077
|
||||
*/
|
||||
/* jshint strict: true */
|
||||
/* globals HAL, Backbone, _, $, window, jqxhr */
|
||||
@@ -39,7 +40,7 @@ var CustomPostForm = Backbone.View.extend({
|
||||
|
||||
var opts = {
|
||||
url: this.$('.url').val(),
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
headers: _.defaults({'Content-Type': 'application/json'}, HAL.client.getHeaders()),
|
||||
method: this.$('.method').val(),
|
||||
data: this.getNewResourceData()
|
||||
};
|
||||
@@ -69,6 +70,7 @@ var CustomPostForm = Backbone.View.extend({
|
||||
try {
|
||||
HAL.client.request({
|
||||
method: 'HEAD',
|
||||
headers: HAL.client.getHeaders(),
|
||||
url: this.href
|
||||
}).done(function (message, text, jqXHR) {
|
||||
self.$el.html(self.template({href: self.href}));
|
||||
@@ -79,7 +81,7 @@ var CustomPostForm = Backbone.View.extend({
|
||||
HAL.client.request({
|
||||
method: 'GET',
|
||||
url: hal._links.profile.href,
|
||||
headers: {'Accept': 'application/schema+json'}
|
||||
headers: _.defaults({'Accept': 'application/schema+json'}, HAL.client.getHeaders())
|
||||
}).done(function (schema) {
|
||||
self.loadJsonEditor(schema);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user