Skip to content

Commit

Permalink
Version 1.0.5
Browse files Browse the repository at this point in the history
新增: 允许跨域,返回json数据,避免部分平台使用后导致出现请求发送下载的情况
  • Loading branch information
Lete114 committed Mar 7, 2022
1 parent 5bde588 commit f97951f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "webstack-screenshot",
"version": "1.0.4",
"version": "1.0.5",
"description": "网站截图 API | Website Screenshot API ",
"main": "index.js",
"scripts": {
Expand Down
5 changes: 5 additions & 0 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ const { launch, goto, screenshot, isBoolean } = require('./utils')

/*eslint-disable max-statements */
module.exports = async (req, res) => {
// 允许所有域
res.setHeader('Access-Control-Allow-Origin', '*')
// 返回json数据
res.setHeader('Content-Type', 'application/json; charset=utf-8')

let browser = null
try {
if (req.url === '/favicon.ico') return res.end()
Expand Down

0 comments on commit f97951f

Please sign in to comment.