Skip to content

Commit

Permalink
feat: support v6 centrifugo
Browse files Browse the repository at this point in the history
  • Loading branch information
SocketSomeone committed Jan 21, 2025
1 parent 36df143 commit 827e9b7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 13 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: actions/checkout@v4

- name: Start Centrifugo
run: docker run -d -p 8000:8000 centrifugo/centrifugo:latest centrifugo --api_insecure
run: docker run -d -p 8000:8000 centrifugo/centrifugo:latest centrifugo --http_api.insecure

- name: Install Node v20
uses: actions/setup-node@v4.1.0
Expand All @@ -28,12 +28,12 @@ jobs:

- name: Run ESlint
run: yarn lint

- name: Run Tests
run: yarn run test --coverage
env:
CENTRIFUGO_HOST: "http://localhost:8000/api"

- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v5
env:
Expand Down
3 changes: 0 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@
"websocket",
"websockets"
],
"dependencies": {
"undici": "7.2.3"
},
"devDependencies": {
"@commitlint/cli": "19.6.1",
"@commitlint/config-angular": "19.7.0",
Expand Down
3 changes: 1 addition & 2 deletions src/cent.client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { CentException } from './cent.exception';
import { CentOptions, Command, CommandParams, CommandResponse } from './interfaces';
import { CentMethods } from './cent-methods.enum';
import { BodyInit, fetch, Response } from 'undici';

export class CentClient {
public constructor(private readonly centOptions: CentOptions) {}
Expand All @@ -19,7 +18,7 @@ export class CentClient {

private methodFactory<M extends CentMethods>(method: M) {
return (params?: CommandParams<M>): Promise<CommandResponse<M>> =>
this.post(this.centOptions.url, JSON.stringify({ method, params }))
this.post(`${this.centOptions.url}/${method}`, JSON.stringify({ params }))
.then(res => res.json() as any)
.then(res => {
if (res?.error) {
Expand Down
5 changes: 0 additions & 5 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 827e9b7

Please sign in to comment.