Skip to content

Commit

Permalink
changed order of body and header interceptors
Browse files Browse the repository at this point in the history
  • Loading branch information
raygig committed Jul 8, 2024
1 parent 65d18b4 commit 1c52c45
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "@firestitch/api",
"title": "API",
"description": "@firestitch/api",
"version": "13.5.4",
"version": "13.5.5",
"repository": {
"type": "git",
"url": "https://github.com/Firestitch/ngx-api"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ export class SingleUploadComponent {

public upload() {
const data = { object: { date: new Date(), file: null }, file: null };
this.files.forEach((fsFile, index) => {
this.files.forEach((fsFile) => {
data.file = fsFile.file;
data.object.file = fsFile.file;
this.kbLoaded = 0;
Expand Down
3 changes: 1 addition & 2 deletions src/app/interceptors/body.interceptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,8 @@ export class BodyInterceptor implements HttpInterceptor {
}

public intercept(req: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
if(this._data) {
if(this._config.encoding === 'formdata') {
const body = objectToFormData(this._data);

req = req.clone({ body });
}

Expand Down
2 changes: 1 addition & 1 deletion src/app/services/api.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -258,9 +258,9 @@ export class FsApi {

private _getInterceptorChain(config: FsApiConfig, data: any): RequestHandler {
const interceptors: HttpInterceptor[] = [
new HeadersInterceptor(config, data),
new BodyInterceptor(config, data),
new ParamsInterceptor(config, data),
new HeadersInterceptor(config, data),
];

if(config.stream) {
Expand Down

0 comments on commit 1c52c45

Please sign in to comment.