![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Another http client with async
Add this line to your application's Gemfile:
gem 'koine-rest_client'
And then execute:
$ bundle
Or install it yourself as:
$ gem install koine-rest_client
# default configuration for every request
request = Koine::RestClient::Request.new(
base_url: 'http://some.endpoint.com/rest',
query_params: { auth_token: 'the-auth-token' },
headers: { 'X-Client' => 'The Collest Client' }
)
client = Koine::RestClient::Client.new(base_request: request)
json_response = client.get('foo/bar')
json_response = client.post(
'foo/bar',
campaign_data,
query_params: { auth_token: 'other_rid' } # other auth_token
)
# or throw on non 200
json_response = client.post(
'foo/bar',
campaign_data,
query_params: { auth_token: nil } # remove auth_token param
)
If you care for the response details:
json_response = client.get('foo/bar') do |response|
if response.code == 1
raise 'what, really?'
end
end
data = client.async do |builder|
builder.get('foo', rid: 'bar') do |response|
builder.get('bar') do |response|
Rails.logger.log(response)
end
builder.post('baz', { payload: :value })
# optional. Raise error if ommited
builder.on_error do |exception|
# ignore
end
end
data[0] # foo response
data[1] # bar response
data[2] # baz response
require 'koine/rest_client/rspec_mock_client'
let(:mock_client) { Koine::RestClient::RspecMockClient.new(spec) }
client.mock do |mocker|
mocker.get('foo').will_return(body: { foo: :bar })
mocker.put('bar', baz: :foo).will_return(body: { baz: :bar })
mocker.delete('error').will_return(code: 400, body: { message: :oops })
end
# or with custom response use the block
client.mock do |mocker|
mocker.get('foo').will_return(body: 'parsed-body') do |response|
double(code: 200, parsed_response: "the #{response.parsed_response}")
end
end
Start the server
./bin/mock_server
request = Koine::RestClient::Request.new(
base_url: 'http://localhost:4321/something',
query_params: { rid: 'internal' },
headers: { 'X-Foo-Bar' => 'foo-bar' }
)
client = Koine::RestClient::Client.new(base_request: request)
client.get('foo') # check the response
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/mjacobus/koine-rest_client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
Everyone interacting in the Koine::RestClient project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the code of conduct.
FAQs
Unknown package
We found that koine-rest_client demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.