diff --git a/spring-data-rest-hal-browser/src/main/resources/META-INF/spring-data-rest/hal-browser/js/CustomPostForm.js b/spring-data-rest-hal-browser/src/main/resources/META-INF/spring-data-rest/hal-browser/js/CustomPostForm.js index 9c03b57a6..0b5f113f4 100644 --- a/spring-data-rest-hal-browser/src/main/resources/META-INF/spring-data-rest/hal-browser/js/CustomPostForm.js +++ b/spring-data-rest-hal-browser/src/main/resources/META-INF/spring-data-rest/hal-browser/js/CustomPostForm.js @@ -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); });