11import https from 'https' ;
22import http from 'http' ;
3+ import { createPublicKey } from 'node:crypto' ;
34import { HttpsProxyAgent } from 'https-proxy-agent' ;
45import nock from 'nock' ;
56import { createLogger } from '@sap-cloud-sdk/util' ;
@@ -13,7 +14,6 @@ import {
1314} from '@sap-cloud-sdk/resilience/internal' ;
1415import { registerDestination } from '@sap-cloud-sdk/connectivity' ;
1516import { registerDestinationCache } from '@sap-cloud-sdk/connectivity/internal' ;
16- import { responseWithPublicKey } from '@sap-cloud-sdk/connectivity/src/scp-cf/jwt/verify.spec' ;
1717import {
1818 basicMultipleResponse ,
1919 connectivityProxyConfigMock ,
@@ -30,7 +30,8 @@ import {
3030 subscriberServiceToken ,
3131 subscriberUserToken ,
3232 testTenants ,
33- xsuaaBindingMock
33+ xsuaaBindingMock ,
34+ publicKey
3435} from '../../../test-resources/test/test-util' ;
3536import * as csrf from './csrf-token-middleware' ;
3637import {
@@ -94,6 +95,21 @@ describe('generic http client', () => {
9495 name : 'FORWARD-TOKEN-NOAUTH'
9596 } ;
9697
98+ function responseWithPublicKey ( key : string = publicKey ) {
99+ const pubKey = createPublicKey ( key ) ;
100+ const jwk = pubKey . export ( { format : 'jwk' } ) ;
101+ return {
102+ keys : [
103+ {
104+ use : 'sig' ,
105+ kid : 'key-id-1' ,
106+ alg : 'RS256' ,
107+ ...jwk
108+ }
109+ ]
110+ } ;
111+ }
112+
97113 describe ( 'buildHttpRequest' , ( ) => {
98114 it ( 'creates an https request' , async ( ) => {
99115 const expectedHttps : DestinationHttpRequestConfig = {
0 commit comments