Simplify relay request headers
CI / test (pull_request) Has been cancelled

This commit is contained in:
2026-06-24 03:52:16 +09:00
parent 1f6e228272
commit 6503bb1b76
8 changed files with 23 additions and 68 deletions
+5 -9
View File
@@ -71,7 +71,7 @@ export function withPosting<TBase extends AbstractConstructor<TwitterClientBase>
let body = buildBody();
try {
const headers = { ...this.getHeaders(), referer: 'https://x.com/compose/post' };
const headers = this.getJsonHeaders();
let response = await this.fetchWithTimeout(urlWithOperation, {
method: 'POST',
headers,
@@ -88,14 +88,14 @@ export function withPosting<TBase extends AbstractConstructor<TwitterClientBase>
response = await this.fetchWithTimeout(urlWithOperation, {
method: 'POST',
headers: { ...this.getHeaders(), referer: 'https://x.com/compose/post' },
headers,
body,
});
if (response.status === 404) {
const retry = await this.fetchWithTimeout(TWITTER_GRAPHQL_POST_URL, {
method: 'POST',
headers: { ...this.getHeaders(), referer: 'https://x.com/compose/post' },
headers,
body,
});
@@ -224,12 +224,8 @@ export function withPosting<TBase extends AbstractConstructor<TwitterClientBase>
try {
const response = await this.fetchWithTimeout(TWITTER_STATUS_UPDATE_URL, {
method: 'POST',
headers: {
...this.getBaseHeaders(),
'content-type': 'application/x-www-form-urlencoded',
referer: 'https://x.com/compose/post',
},
body: params.toString(),
headers: this.getHeaders(),
body: params,
});
if (!response.ok) {