Breeze 0.70.1부터는 서버의 breeze 클라이언트와 웹 서비스 간의 Ajax 통신을 완전히 사용자 정의하거나 바꿀 수있는 기능을 지원합니다.
Ajax 지원에 대한 Breeze 설명서는 아직 진행 중이지만 잘하면 다음과 같이 시작할 수 있습니다.
Breeze가 만드는 모든 Ajax 요청에서 헤더를 제어하려면 앱을 처음 시작할 때 다음 코드를 실행할 수 있습니다.
var ajaxImpl = breeze.config.getAdapterInstance("ajax");
ajaxImpl.defaultSettings = {
headers: {
// any CORS or other headers that you want to specify.
"X-Test-Header": "foo2"
},
};
또는 개별 Ajax 호출을 가로 채고 요청에 따라 선택적으로 헤더를 추가 할 수 있습니다.
var ajaxImpl = breeze.config.getAdapterInstance("ajax");
ajaxImpl.defaultSettings = {
beforeSend: function(jqXHR, settings) {
// examine the jqXHR or settings and customize the headers accordingly.
jqXHR.setRequestHeader("X-Test-Before-Send-Header", "foo2");
}
};