fix(server): HttpRequestService.sendでは常にUser-Agentを含むように
Fix #9817 (maybe)
This commit is contained in:
		
							parent
							
								
									8d4c5deb8d
								
							
						
					
					
						commit
						55d4d3418e
					
				
					 1 changed files with 4 additions and 3 deletions
				
			
		| 
						 | 
					@ -99,7 +99,6 @@ export class HttpRequestService {
 | 
				
			||||||
		const res = await this.send(url, {
 | 
							const res = await this.send(url, {
 | 
				
			||||||
			method: 'GET',
 | 
								method: 'GET',
 | 
				
			||||||
			headers: Object.assign({
 | 
								headers: Object.assign({
 | 
				
			||||||
				'User-Agent': this.config.userAgent,
 | 
					 | 
				
			||||||
				Accept: accept,
 | 
									Accept: accept,
 | 
				
			||||||
			}, headers ?? {}),
 | 
								}, headers ?? {}),
 | 
				
			||||||
			timeout: 5000,
 | 
								timeout: 5000,
 | 
				
			||||||
| 
						 | 
					@ -114,7 +113,6 @@ export class HttpRequestService {
 | 
				
			||||||
		const res = await this.send(url, {
 | 
							const res = await this.send(url, {
 | 
				
			||||||
			method: 'GET',
 | 
								method: 'GET',
 | 
				
			||||||
			headers: Object.assign({
 | 
								headers: Object.assign({
 | 
				
			||||||
				'User-Agent': this.config.userAgent,
 | 
					 | 
				
			||||||
				Accept: accept,
 | 
									Accept: accept,
 | 
				
			||||||
			}, headers ?? {}),
 | 
								}, headers ?? {}),
 | 
				
			||||||
			timeout: 5000,
 | 
								timeout: 5000,
 | 
				
			||||||
| 
						 | 
					@ -144,7 +142,10 @@ export class HttpRequestService {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		const res = await fetch(url, {
 | 
							const res = await fetch(url, {
 | 
				
			||||||
			method: args.method ?? 'GET',
 | 
								method: args.method ?? 'GET',
 | 
				
			||||||
			headers: args.headers,
 | 
								headers: {
 | 
				
			||||||
 | 
									'User-Agent': this.config.userAgent,
 | 
				
			||||||
 | 
									...(args.headers ?? {})
 | 
				
			||||||
 | 
								},
 | 
				
			||||||
			body: args.body,
 | 
								body: args.body,
 | 
				
			||||||
			size: args.size ?? 10 * 1024 * 1024,
 | 
								size: args.size ?? 10 * 1024 * 1024,
 | 
				
			||||||
			agent: (url) => this.getAgentByUrl(url),
 | 
								agent: (url) => this.getAgentByUrl(url),
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue