diff --git a/scrapypuppeteer/response.py b/scrapypuppeteer/response.py index 942b2d0..cb032ef 100644 --- a/scrapypuppeteer/response.py +++ b/scrapypuppeteer/response.py @@ -53,6 +53,7 @@ def __init__(self, url, puppeteer_request, context_id, page_id, **kwargs): self.cookies = kwargs.pop('cookies') kwargs.setdefault('body', self.html) kwargs.setdefault('encoding', 'utf-8') + kwargs.setdefault('headers', {}).setdefault('Content-Type', 'text/html') super().__init__(url, puppeteer_request, context_id, page_id, **kwargs) @@ -64,7 +65,8 @@ class PuppeteerJsonResponse(PuppeteerResponse): def __init__(self, url, puppeteer_request, context_id, page_id, **kwargs): self.data = kwargs - super().__init__(url, puppeteer_request, context_id, page_id) + headers = {'Content-Type': 'application/json'} + super().__init__(url, puppeteer_request, context_id, page_id, headers=headers) class PuppeteerScreenshotResponse(PuppeteerResponse): diff --git a/setup.py b/setup.py index 8830d67..ef58b15 100644 --- a/setup.py +++ b/setup.py @@ -7,7 +7,7 @@ setup( name='scrapy-puppeteer-client', - version='0.0.5', + version='0.0.6', description='A library to use Puppeteer-managed browser in Scrapy spiders', long_description=long_description, long_description_content_type="text/markdown",