Skip to content

Commit

Permalink
Merge pull request #10 from RESTyard/fix/schema-request-headers-missing
Browse files Browse the repository at this point in the history
Fix schema request not using header factory
  • Loading branch information
MathiasReichardt authored Mar 12, 2024
2 parents 4d86159 + 6419b8a commit d90acbf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@restyard/siren-client",
"version": "0.3.0",
"version": "0.3.1",
"description": "Basic siren client.",
"main": "./dist/cjs/index.js",
"module": "./dist/esm5/index.js",
Expand Down
9 changes: 8 additions & 1 deletion src/siren-deserializer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,15 @@ import { EmbeddedEntity } from './siren-model/embedded-entity';
import { ObservableLruCache } from './observable-lru-cache';

import { MediaTypes } from "./media-types";
import { HttpHeadersFactory } from './contracts';

export class SirenDeserializer {
private readonly waheActionTypes = [MediaTypes.Json, MediaTypes.FormData, MediaTypes.OctetStream];

private static httpInputTypeFile = 'file';
constructor(
private httpClient: HttpClient,
private httpHeadersFactory: HttpHeadersFactory,
private schemaCache: ObservableLruCache<object>, // todo convert to interface, let users inject it
private schemaSimplifier: SchemaSimplifier // todo convert to interface, let users inject it
) {
Expand Down Expand Up @@ -298,7 +300,12 @@ export class SirenDeserializer {
return;
}

const simplifiedResponse$ = this.httpClient.get(schemaUrl)
var headers = this.httpHeadersFactory.create();
const simplifiedResponse$ = this.httpClient.get(
schemaUrl,
{
headers: headers
})
.pipe(
map(response => {
this.schemaSimplifier.simplifySchema(response);
Expand Down

0 comments on commit d90acbf

Please sign in to comment.