I am facing a challenge with attributes in my TypeScript class that are written in camelCase format. The instance of this class needs to be used in an HTTP request body for a web service that has its backend written in C#. However, the backend is trying to access the attributes using UpperCamelCase notation.
What can I do to convert the attributes of my class from camelCase to UpperCamelCase when sending it in an HTTP request?
For example:
class Test1:
httpClient: CustomHttpClient;
public attributeOne;
public attributeTwo;
constructor(att1,att2):{
this.attributeOne = att1;
this.attributeTwo = att2;
this.httpClient = new CustomHttpClient();
}
sendRequest(){
const test = new Test1();
this.httpClient.post(url, test , null);
}
The web service will attempt to access the body as follows:
test.AttributeOne
test.AttributeTwo;
This will result in an error since such attributes do not exist.
I prefer not to change my attributes in TypeScript to UpperCamelCase due to linting reasons, etc.. How can I solve this dilemma?