Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Added option to override request #99

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
khartnett wants to merge 2 commits into alvarcarto:master
base: master
Choose a base branch
Loading
from ADEvantageTechnologyInc:override-request

Conversation

@khartnett
Copy link

@khartnett khartnett commented Feb 25, 2019

This change allows overriding the request, so you can render a page that uses a post request.
Example:

curl -X POST \
 https://url-to-pdf-api.herokuapp.com/api/render \
 -H 'Content-Type: application/json' \
 -H 'cache-control: no-cache' \
 -d '{ "url": "https://en.wikipedia.org/w/index.php", "request": { "method":"POST", "headers": { "cache-control": "no-cache", "content-type": "application/x-www-form-urlencoded" }, "postData": "search=pdf&title=Special%3ASearch&go=Go" } }'

'screenshot.clip.width': Joi.number(),
'screenshot.clip.height': Joi.number(),
'screenshot.omitBackground': Joi.boolean(),
// 'request.headers': Joi.object(), // any way to send an object?
Copy link
Author

@khartnett khartnett Feb 25, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if there are any clever workarounds here. Could optionally be a json string that gets decoded? I think #78 has this same issue.

Copy link
Member

Thanks for the contribution. I think this is a great idea.

I don't have currently time to help with this but I like the idea of having full control to the request. It opens up even easier ways to exploit this service to make requests to internal services etc, but that's what the API_KEY is for.

Copy link

I have a fork of this project I maintain for an internal app my company has. I've had to modify this so that it allows a JSON POST body that the app will make rather than.

I added a field called postJsonData and useJsonPost, which modifies the very first request to...well POST the provided json to the target. We use this to get a specific rendered HTML page based on the payload we send it.

This doesn't look like it's gotten any traction, but I'd love to see this merged into the project as otherwise I have to maintain a constantly-rebased fork.

Here's the meat of the change.
image

Copy link

lucawen commented Aug 24, 2020

its not make sense create a service that we cant pass a authorization to it. Why not accept the pr? its just a simple thing...

Copy link

For those who are looking for a tool that has this feature, I've been using this micro-service with great success. I think if the authors don't wish to add it, that is fine. The whole point of open source stuff is we can fix it/add it ourselves or swap it out.

https://github.com/thecodingmachine/gotenberg

maxshuty reacted with thumbs up emoji maxshuty reacted with rocket emoji

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /