Skip to content

Conversation

@timvisee
Copy link
Member

@timvisee timvisee commented Jun 19, 2025

Bumps #89

Following the same reasoning as qdrant/qdrant-client#1028

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR standardizes the User-Agent header prefix to javascript-client across both REST and gRPC clients.

  • Changed REST client header from qdrant-js/<version> to javascript-client/<version>
  • Changed gRPC client interceptor header from qdrant-js/<version> to javascript-client/<version>

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
packages/js-client-rest/src/qdrant-client.ts Updated user-agent header to javascript-client/<version>
packages/js-client-grpc/src/api-client.ts Modified gRPC interceptor to set user-agent to javascript-client/<version>
Comments suppressed due to low confidence (2)

packages/js-client-rest/src/qdrant-client.ts:97

  • Add a unit test to verify that the REST client sets the user-agent header to javascript-client/<PACKAGE_VERSION>, ensuring future changes don't break this behavior.
        const headers = new Headers([['user-agent', 'javascript-client/' + String(PACKAGE_VERSION)]]);

packages/js-client-grpc/src/api-client.ts:55

  • Add a test for the gRPC interceptor to confirm that the user-agent header is correctly set to javascript-client/<PACKAGE_VERSION> on every request.
            req.header.set('user-agent', 'javascript-client/' + String(PACKAGE_VERSION));

}

const headers = new Headers([['user-agent', 'qdrant-js/' + String(PACKAGE_VERSION)]]);
const headers = new Headers([['user-agent', 'javascript-client/' + String(PACKAGE_VERSION)]]);
Copy link

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider extracting the 'javascript-client/' + String(PACKAGE_VERSION) value into a shared constant to avoid duplication between REST and gRPC clients.

Suggested change
const headers = new Headers([['user-agent', 'javascript-client/' + String(PACKAGE_VERSION)]]);
const headers = new Headers([['user-agent', USER_AGENT]]);

Copilot uses AI. Check for mistakes.
const interceptors: Interceptor[] = [
(next) => (req) => {
req.header.set('user-agent', 'qdrant-js/' + String(PACKAGE_VERSION));
req.header.set('user-agent', 'javascript-client/' + String(PACKAGE_VERSION));
Copy link

Copilot AI Jun 19, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Consider moving the user-agent string construction into a shared utility or constant to keep the REST and gRPC implementations consistent and DRY.

Suggested change
req.header.set('user-agent', 'javascript-client/' + String(PACKAGE_VERSION));
req.header.set('user-agent', getUserAgent());

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants