Merge pull request #367 from shikorism/feature/user-agent
外部へのHTTPリクエストに独自のUser-Agentを付与する
This commit is contained in:
		@@ -26,6 +26,10 @@ commands:
 | 
			
		||||
      - run: sudo apt install -y libpq-dev
 | 
			
		||||
      - run: sudo docker-php-ext-install zip
 | 
			
		||||
      - run: sudo docker-php-ext-install pdo_pgsql
 | 
			
		||||
      - run:
 | 
			
		||||
          command: |
 | 
			
		||||
            curl -sSL "https://nodejs.org/dist/v12.16.3/node-v12.16.3-linux-x64.tar.xz" | sudo tar --strip-components=2 -xJ -C /usr/local/bin/ node-v12.16.3-linux-x64/bin/node
 | 
			
		||||
            curl https://www.npmjs.com/install.sh | sudo bash
 | 
			
		||||
  restore_composer:
 | 
			
		||||
    steps:
 | 
			
		||||
      - restore_cache:
 | 
			
		||||
 
 | 
			
		||||
@@ -3,6 +3,8 @@
 | 
			
		||||
namespace App\Providers;
 | 
			
		||||
 | 
			
		||||
use App\MetadataResolver\MetadataResolver;
 | 
			
		||||
use GuzzleHttp\Client;
 | 
			
		||||
use GuzzleHttp\RequestOptions;
 | 
			
		||||
use Illuminate\Support\Facades\Blade;
 | 
			
		||||
use Illuminate\Support\ServiceProvider;
 | 
			
		||||
use Parsedown;
 | 
			
		||||
@@ -36,5 +38,12 @@ class AppServiceProvider extends ServiceProvider
 | 
			
		||||
        $this->app->singleton('parsedown', function () {
 | 
			
		||||
            return Parsedown::instance();
 | 
			
		||||
        });
 | 
			
		||||
        $this->app->bind(Client::class, function () {
 | 
			
		||||
            return new Client([
 | 
			
		||||
                RequestOptions::HEADERS => [
 | 
			
		||||
                    'User-Agent' => 'TissueBot/1.0'
 | 
			
		||||
                ]
 | 
			
		||||
            ]);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user