Skip to content

Commit

Permalink
fix: handle 201 response from write endpoint (#1044)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacobmarble authored Aug 14, 2024
1 parent 7bd9fb9 commit fff3615
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## 1.35.0 [unreleased]

### Bug Fixes

1. [#1044](https://github.com/influxdata/influxdb-client-js/pull/1044): Allow 201 status code in a write response.

## 1.34.0 [2024-07-26]

### Breaking Changes
Expand Down
7 changes: 6 additions & 1 deletion packages/core/src/impl/WriteApiImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -236,8 +236,13 @@ export default class WriteApiImpl implements WriteApi {
reject(error)
},
complete(): void {
// InfluxDB v3 returns 201 for partial success
// older implementations of transport do not report status code
if (responseStatusCode == 204 || responseStatusCode == undefined) {
if (
responseStatusCode == 204 ||
responseStatusCode == 201 ||
responseStatusCode == undefined
) {
self.writeOptions.writeSuccess.call(self, lines)
self.retryStrategy.success()
resolve()
Expand Down

0 comments on commit fff3615

Please sign in to comment.