Skip to content

Commit

Permalink
Release proxy (#278)
Browse files Browse the repository at this point in the history
* build(deps): bump http-cache-semantics from 4.1.0 to 4.1.1

Bumps [http-cache-semantics](https://github.com/kornelski/http-cache-semantics) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/kornelski/http-cache-semantics/releases)
- [Commits](kornelski/http-cache-semantics@v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: http-cache-semantics
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

* build(deps): bump @nestjs/core from 9.0.4 to 9.0.5

Bumps [@nestjs/core](https://github.com/nestjs/nest) from 9.0.4 to 9.0.5.
- [Release notes](https://github.com/nestjs/nest/releases)
- [Commits](nestjs/nest@v9.0.4...v9.0.5)

---
updated-dependencies:
- dependency-name: "@nestjs/core"
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* build(deps): bump webpack and @nestjs/cli

Bumps [webpack](https://github.com/webpack/webpack) to 5.80.0 and updates ancestor dependency [@nestjs/cli](https://github.com/nestjs/nest-cli). These dependencies need to be updated together.


Updates `webpack` from 5.73.0 to 5.80.0
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.73.0...v5.80.0)

Updates `@nestjs/cli` from 9.0.0 to 9.4.2
- [Release notes](https://github.com/nestjs/nest-cli/releases)
- [Changelog](https://github.com/nestjs/nest-cli/blob/master/.release-it.json)
- [Commits](nestjs/nest-cli@9.0.0...9.4.2)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: indirect
- dependency-name: "@nestjs/cli"
  dependency-type: direct:development
...

Signed-off-by: dependabot[bot] <[email protected]>

* fix(proxy): allow "Content-Type" & "Accept" headers provided by request (#277)

Co-authored-by: Mathieu Tho <[email protected]>

* build(deps): bump cookiejar from 2.1.3 to 2.1.4 (#268)

Bumps [cookiejar](https://github.com/bmeck/node-cookiejar) from 2.1.3 to 2.1.4.
- [Release notes](https://github.com/bmeck/node-cookiejar/releases)
- [Commits](https://github.com/bmeck/node-cookiejar/commits)

---
updated-dependencies:
- dependency-name: cookiejar
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Update CHANGELOG.md

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Ping-YUAN <[email protected]>
Co-authored-by: Mathieu <[email protected]>
Co-authored-by: Mathieu Tho <[email protected]>
  • Loading branch information
5 people authored May 23, 2023
1 parent 0e0dba3 commit 3366121
Show file tree
Hide file tree
Showing 5 changed files with 730 additions and 625 deletions.
8 changes: 8 additions & 0 deletions libs/proxy/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

<!-- TOC depthfrom:2 depthto:3 -->

- [2023-06-23](#2023-06-23)
- [Bugfixes](#bugfixes)
- [2022-05-18](#2022-05-18)
- [Features](#features)
- [2021-11-4](#2021-11-4)
Expand Down Expand Up @@ -31,6 +33,12 @@

<!-- /TOC -->

## 0.7.1 (2023-06-23)

### Bugfixes

- Fixes [#276](https://github.com/Finastra/finastra-nodejs-libs/pull/276), allowing `Content-Type` & `Accept` headers provided by request

## 0.7.0 (2022-05-18)

### Features
Expand Down
2 changes: 1 addition & 1 deletion libs/proxy/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@finastra/nestjs-proxy",
"version": "0.7.0",
"version": "0.7.1",
"contributors": [
"David Boclé <[email protected]>"
],
Expand Down
12 changes: 10 additions & 2 deletions libs/proxy/src/services/proxy.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,19 @@ export class ProxyService {
target: getBaseURL(target),
headers: {
...(token && { authorization: 'Bearer ' + token }),
'content-type': 'application/json',
accept: 'application/json',
},
};

// Set default "Accept" header if not provided by request headers or is set to "*/*"
if (!('accept' in req.headers) || req.headers.accept === '*/*') {
defaultOptions.headers['accept'] = 'application/json'
}

// Set default "Content-Type" header if not provided by request headers
if (!('content-type' in req.headers)) {
defaultOptions.headers['content-type'] = 'application/json'
}

// Allow http-server options overriding
const requestOptions = { ...defaultOptions, ...options };
requestOptions.headers = {
Expand Down
Loading

0 comments on commit 3366121

Please sign in to comment.