File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ /**
2+ * Package name used as User-Agent header
3+ */
4+ export const USER_AGENT = 'stackone-ai-node' ;
5+
16/**
27 * Default base URL for StackOne API
38 */
Original file line number Diff line number Diff line change 1+ import { USER_AGENT } from './consts' ;
12import {
23 type ExecuteOptions ,
34 type HttpBodyType ,
@@ -57,7 +58,7 @@ export class RequestBuilder {
5758 */
5859 prepareHeaders ( ) : Record < string , string > {
5960 return {
60- 'User-Agent' : 'stackone-ai-node' ,
61+ 'User-Agent' : USER_AGENT ,
6162 ...this . headers ,
6263 } ;
6364 }
Original file line number Diff line number Diff line change 1+ import { DEFAULT_BASE_URL , USER_AGENT } from './consts' ;
12import { STACKONE_HEADER_KEYS } from './headers' ;
23import {
34 type RpcActionRequest ,
@@ -25,7 +26,7 @@ export class RpcClient {
2526
2627 constructor ( config : RpcClientConfig ) {
2728 const validatedConfig = rpcClientConfigSchema . parse ( config ) ;
28- this . baseUrl = validatedConfig . serverURL || 'https://api.stackone.com' ;
29+ this . baseUrl = validatedConfig . serverURL || DEFAULT_BASE_URL ;
2930 const username = validatedConfig . security . username ;
3031 const password = validatedConfig . security . password || '' ;
3132 this . authHeader = `Basic ${ Buffer . from ( `${ username } :${ password } ` ) . toString ( 'base64' ) } ` ;
@@ -68,7 +69,7 @@ export class RpcClient {
6869 const httpHeaders = {
6970 'Content-Type' : 'application/json' ,
7071 Authorization : this . authHeader ,
71- 'User-Agent' : 'stackone-ai-node' ,
72+ 'User-Agent' : USER_AGENT ,
7273 ...forwardedHeaders ,
7374 } satisfies Record < string , string > ;
7475
Original file line number Diff line number Diff line change 1- // Type aliases for common types
1+ import { USER_AGENT } from '../consts' ;
22
33/**
44 * Base exception for StackOne errors
@@ -73,7 +73,7 @@ export class StackOneAPIError extends StackOneError {
7373 // Add request headers information (for debugging)
7474 errorMessage += '\n\nRequest Headers:' ;
7575 errorMessage += '\n- Authorization: [REDACTED]' ;
76- errorMessage += ' \n- User-Agent: stackone-ai-node' ;
76+ errorMessage += ` \n- User-Agent: ${ USER_AGENT } ` ;
7777
7878 // Add request body information if available
7979 if ( this . requestBody ) {
You can’t perform that action at this time.
0 commit comments