twitter-openapi-typescript icon indicating copy to clipboard operation
twitter-openapi-typescript copied to clipboard

Why your library make unneeded request?

Open thander opened this issue 1 year ago • 1 comments

Are you intercept my requests? Снимок экрана 2024-11-06 в 23 28 28

thander avatar Nov 06 '24 16:11 thander

In twitter-openapi-typescript, two additional requests are made:

  1. Fetching default argument values:
    The library retrieves default argument values from an external JSON file to address limited support for default arguments in the OpenAPI specification and openapi-generator. You can find this JSON file here: placeholder.json.
    Since an insertion of malicious code in this file could cause issues, we use a fixed commit hash to mitigate that risk.

  2. Fetching the latest User-Agent:
    The library also retrieves an updated User-Agent header from this file: header.json. This ensures compliance with Twitter’s requirements, as using an outdated User-Agent could result in account suspension.
    Unlike the placeholder file, this file does not use a fixed commit hash because it must stay up-to-date. Updates are managed by me and a GitHub Action, ensuring the latest User-Agent is used while minimizing risks from malicious code.

If these additional requests are an issue, I recommend initializing the library with TwitterOpenApiClient instead of TwitterOpenApi: TwitterOpenApiClient.

We also welcome pull requests if you'd like to contribute improvements!

fa0311 avatar Nov 06 '24 16:11 fa0311