
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
A quick way of mocking an external web service you want to consume.
You're writing a feature that needs to connect to an external web service (anything served by HTTP). You wonder how to test that. Your options are to stub methods in Net::HTTP and equivalents, but by doing that you are tying yourself to an implementation detail. The ideal thing to do is to lay out an environment where your code can still run, connect to a web server, send out requests and get responses back. Enter MockServer.
class RSSFeedTest < Test::Unit::TestCase
extend MockServer::Methods
mock_server {
get "/feed.xml" do
<<-EOS
<?xml version="1.0"?>
<rss version="2.0">
<channel>
<title>A mock website</title>
<link>http://example.com/</link>
</channel>
</rss>
EOS
end
}
def test_rss_feed
# YourAwesomeComponent should connect to http://localhost:4000.
# (you *are* putting those URLs in an environment-aware config file, right?)
posts = YourAwesomeComponent.load_posts
assert_equal "A mock website", post.first.channel.title
end
end
Yes, things happening inside the mock_server
call are just a regular Sinatra application. w00t!
MIT.
FAQs
Unknown package
We found that mock-server 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
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.