vergilet / repost Goto Github PK
View Code? Open in Web Editor NEWRedirect using POST method
Home Page: https://vergilet.github.io/repost
License: MIT License
Redirect using POST method
Home Page: https://vergilet.github.io/repost
License: MIT License
Hi,
I'm trying to use this gems to redirect to other POST action in other controller API.
Repost::Senpai.perform('http://xxxx', params: { auth: request.params[:user] })
However I receive this error No template found for xxController#create, rendering head :no_content
. I tried to add html.erb in views to solve that error. But after that, the response from my API is the HTML from the view. So it doesn't redirect to action in another controller, but only render the view.
Can anyone give me further explanation of how to use this gems to redirect controller API?
I have followed the documentation, but still can't redirect to the POST action
Thank you in advance
It throws undefined method error on my Rails 6.
I am presently trying to use it for my Rails Api
Steps I took:
gem 'repost'
bundle install
module Api::V1
class UsersController < ApplicationController
...
def create
@user = User.new(user_create_params)
if @user.save
repost(api_v1_user_token_path, params: { auth: request.params[:user] })
else
json_response(@user.errors.full_messages, :bad_request)
end
end
end
end
It however throws an error: NoMethodError (undefined method 'repost' for #<Api::V1::UsersController:0x0000558eeb152d98>)
Hi great and useful gem. Is there a way to set an authenticity token for a request? I assume this is a pretty common use case:
def redeem_via_code
repost('/orders/rc',
params: {
code: params[:id]
}
)
end
Im trying to recreate a post from shopify cart to test on
it has nested params,
Im returning - undefined method `map' for nil:NilClass Did you mean? Tap
Im assuming the repost map isn't set to handle nested values ?
Hi @vergilet,
I was checking this gem. My controller receives an ajax request, and after processing it, I need to redirect user to their specified url along with posting some payload.
I tried to use redirect_post
method but it's not redirecting. Would it be possible to use while in ajax request?
Thanks
I'm on a EOL rails installation and returning this issue ( 4.2.6 , yes that old)
undefined local variable or method `content_security_policy_nonce' for for #
Ill have a pull-apart , might have to unbundle and comment out ?
Thanks for the great app. However, I cannot use instance variable into params
.
redirect_post(url, # URL, looks understandable
params: {
'amt': amount,
'pdc': 0,
'psc': 0,
'txAmt': 0,
'tAmt': amount,
'pid': 'ee2c3ca1-696b-4cc5-a6be-2c40d929d453',
'scd': 'EPAYTEST',
'su': 'http://merchant.com.np/page/esewa_payment_success?q=su',
'fu': 'http://merchant.com.np/page/esewa_payment_failed?q=fu'
}, # Your request body, also nested params and arrays
options: {
method: :post, # OPTIONAL - DEFAULT is :post, but you can use others if needed
authenticity_token: 'auto'
}
)
I have a variable amount which return integer and the 'amt' parameter only accepts number. How do I solve this issue?
Howdy! This is less of a bug and more of a question. I've been loving this gem as it solves some pains around a lot of the OAuth work I have been doing recently. Question is this: In system tests or controller RSpec tests...what is the best way to assert the behavior when the response is a redirect_post
?
What I've done up until now is assert that the an instance of ApplicationController receives redirect_post with expected arguments, but it would be cool to assert that in a nicer way and even perhaps be able to stub that response so the controller still responds with a payload.
Thanks for making this super-handy gem!
Just a heads up that I'm seeing a deprecation warning after adding repost
to a Rails 6 app. The warning shows up at the beginning of the rspec test suite. Here it is:
DEPRECATION WARNING: Initialization autoloaded the constants ActionText::ContentHelper and ActionText::TagHelper.
Being able to do this is deprecated. Autoloading during initialization is going
to be an error condition in future versions of Rails.
Reloading does not reboot the application, and therefore code executed during
initialization does not run again. So, if you reload ActionText::ContentHelper, for example,
the expected changes won't be reflected in that stale Module object.
These autoloaded constants have been unloaded.
Please, check the "Autoloading and Reloading Constants" guide for solutions.
It appears that the cause of this warning is line 2 in lib/repost/extend_controller.rb
.
Hello,
First off, thank you for a very nice gem!
We are running an older Ruby version; 2.3.8 in our production environment, and the gem breaks as the method String.concat does not allow for multiple arguments in 2.3.8.
In senpai.rb@24 the code states: form_head.concat(compiled_body, form_footer)
That results in an error: "ArgumentError: wrong number of arguments (given 2, expected 1)" in Ruby 2.3.8.
The gem works fine in my development environment as I use a higher Ruby version.
I think I'll be able to make a fix if wanted.
Kind regards
Mads
Hi,
Thank you for the gem, we have recently encountered an issue and our tests were intermittently failing while using the gem for an use case when there is a quoted string in the param value the partial string is being sent
I have tried to create pr to fix the issue but looks like i do not have permission
this is how i would go about fixing,
could you consider this changes and let me know your opinion
I tried it with Roda and it doesn't seem to work. Any idea if there will be support for Roda?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.