EmailClient -> listSuppressions doesn't url encode email special characters in requestEndpoint
greg-md opened this issue · 2 comments
greg-md commented
Hello,
When an email address contains special characters like +, the request fails with 400 invalid email parameter error:
statusCode: 400,
serviceCode: 'InvalidParameter',
opcRequestId: '43FCB4E031F8-11EF-8CD1-BF8CE55FC/2B6CD7C119E2429B8D904913FEAEF72E/95DB72DF682D438C8464F14B2370B445',
targetService: 'Email',
operationName: 'listSuppressions',
timestamp: '2024-06-24T07:06:23.407Z',
requestEndpoint: 'GET https://ctrl.email.us-phoenix-1.oci.oraclecloud.com/20170907/suppressions?compartmentId=ocid1.tenancy.oc1..aaaaaaaa3wam7rmtqbw7nktj6vd6pagns43c2afnohud6swc7dehqrbzolva&emailAddress=foo+bar@domain.com',
clientVersion: 'Oracle-TypeScriptSDK/2.81.0',Based on requestEndpoint from the log, seems like the email was not url encoded, so I had to manually url encode email address before calling the SDK:
const client = new EmailClient({ authenticationDetailsProvider: provider });
const listSuppressionsResponse = await client.listSuppressions({
compartmentId: provider.getTenantId(),
emailAddress: encodeURIComponent(email),
});But it would be good if SDK will url encode query parameters by itself.
jyotisaini commented
@y-chandra Can you check if we url encode query params in the typescript SDK. AFAIR we do encode them.
greg-md commented
@jyotisaini I have checked the sdk source code before writing this issue and the query params were not url encoded.