Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 45 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: CI

on:
push:
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
ruby-version: ["3.0", "3.1", "3.2", "3.3", "3.4"]

steps:
- uses: actions/checkout@v4

- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler-cache: true

- name: Run tests
run: bundle exec rspec

- name: Upload coverage to Coveralls
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
file: coverage/.resultset.json
format: simplecov
flag-name: ruby-${{ matrix.ruby-version }}
parallel: true

coveralls-finish:
needs: test
if: always()
runs-on: ubuntu-latest
steps:
- name: Mark Coveralls parallel build as finished
uses: coverallsapp/github-action@v2
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
parallel-finished: true
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

## [1.10.1] - 2026-03-24

### Fixed

- Robust HTTP method detection in request management using `caller_locations` with fallback logic, fixing Ruby 3.4 compatibility for capture/stats method keys (`GET`, `POST`, etc.).

## [1.10.0] - 2026-02-13

### Added
Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ group :test do
gem "rspec"
gem "sinatra", "~> 3.0"
gem "webrick"
gem "coveralls_reborn", "~> 0.27.0", require: false
gem "simplecov", "~> 0.22.0", require: false
end

# Specify your gem's dependencies in mygem.gemspec
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# NiceHttp

[![Gem Version](https://badge.fury.io/rb/nice_http.svg)](https://rubygems.org/gems/nice_http)
[![Build Status](https://travis-ci.com/MarioRuiz/nice_http.svg?branch=master)](https://github.com/MarioRuiz/nice_http)
[![CI](https://github.com/MarioRuiz/nice_http/actions/workflows/ci.yml/badge.svg)](https://github.com/MarioRuiz/nice_http/actions/workflows/ci.yml)
[![Coverage Status](https://coveralls.io/repos/github/MarioRuiz/nice_http/badge.svg?branch=master)](https://coveralls.io/github/MarioRuiz/nice_http?branch=master)
![Gem](https://img.shields.io/gem/dt/nice_http)
![GitHub commit activity](https://img.shields.io/github/commit-activity/y/MarioRuiz/nice_http)
Expand Down
11 changes: 10 additions & 1 deletion lib/nice_http/manage/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,16 @@ def manage_request(*arguments_param)
}
headers_t["Cookie"] = cookies_to_set_str

method_s = caller[0].to_s().scan(/:in `(.*)'/).join
method_s = caller_locations(1, 10).map(&:base_label).find do |label|
%w[get post put patch delete head send_request].include?(label)
end
if method_s == "send_request" && arguments.size == 1 && arguments[0].kind_of?(Hash) && arguments[0].key?(:method)
method_s = arguments[0][:method].to_s
end
if method_s.to_s == ""
method_s = caller[0].to_s().scan(/:in `(.*)'/).join
end
method_s = "request" if method_s.to_s == ""
@request[:method] = method_s.upcase
self.class.request[:method] = @request[:method]

Expand Down
2 changes: 1 addition & 1 deletion nice_http.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |s|
s.name = "nice_http"
s.version = "1.10.0"
s.version = "1.10.1"
s.summary = "NiceHttp -- simplest library for accessing and testing HTTP and REST resources. Get http logs and statistics automatically. Use hashes on your requests. Access JSON even easier."
s.description = "NiceHttp -- simplest library for accessing and testing HTTP and REST resources. Get http logs and statistics automatically. Use hashes on your requests. Access JSON even easier."
s.authors = ["Mario Ruiz"]
Expand Down
3 changes: 2 additions & 1 deletion spec/nice_http/validate_response_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@
expected = {}
result = described_class.validate_response(resp, expected)
expect(result[:ok]).to be false
expect(result[:error]).to be_present
expect(result[:error]).to be_a(String)
expect(result[:error]).not_to be_empty
end

it "accepts nested expected structure" do
Expand Down
6 changes: 3 additions & 3 deletions spec/spec_helper.rb
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
require "simplecov"
SimpleCov.start

# Start local fake API server(s) in-process and set HOST_EXAMPLE_SINATRA / TEST_SERVER_URL (set USE_FAKE_API=false to use external hosts)
require_relative "support/server" if File.exist?(File.join(__dir__, "support", "server.rb"))
ENV["HOST_EXAMPLE_SINATRA"] ||= "http://localhost:4567"
TEST_SERVER_URL = ENV["TEST_SERVER_URL"] || "http://localhost:4567" unless defined?(TEST_SERVER_URL)
TEST_SERVER_URL_2 = ENV["TEST_SERVER_URL_2"] || "http://localhost:4568" unless defined?(TEST_SERVER_URL_2)

require "coveralls"
Coveralls.wear!

# This file was generated by the `rspec --init` command. Conventionally, all
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
# The generated `.rspec` file contains `--require spec_helper` which will cause
Expand Down
Loading