New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

katana-client

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

katana-client

A powerful HTTP client module similar to axios

  • 1.0.2
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-85.71%
Maintainers
1
Weekly downloads
 
Created
Source
# KatanaClient

KatanaClient, HTTP ve HTTPS üzerinden istek göndermek için kullanılabilecek basit ve esnek bir Node.js istemci modülüdür.

## Özellikler

- GET, POST, PUT, DELETE, HEAD, OPTIONS, PATCH, TRACE, CONNECT gibi yaygın HTTP metotlarını destekler.
- URL parametreleri ve istek başlıklarını özelleştirebilme yeteneği.
- Yönlendirme (redirect) takibi ve yönetimi.
- Zaman aşımı (timeout) işleme.
- Özelleştirilebilir HTTP(s) agent desteği.

## Kurulum

Modülü npm üzerinden kurmak için:

```bash
npm install katana-client

Kullanım

const KatanaClient = require('katana-client');

const client = new KatanaClient({
  timeout: 10000, // Opsiyonel: Zaman aşımı süresi (ms)
  maxRedirects: 5, // Opsiyonel: Maksimum yönlendirme sayısı
  followRedirects: true, // Opsiyonel: Yönlendirme takibi
  defaultHeaders: {
    'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
  }
});

// GET request
client.get('https://api.example.com/data')
  .then(response => {
    console.log('GET Response:', response);
  })
  .catch(error => {
    console.error('GET Error:', error.message);
  });

// POST request
const postData = { key: 'value' };
client.post('https://api.example.com/post', postData)
  .then(response => {
    console.log('POST Response:', response);
  })
  .catch(error => {
    console.error('POST Error:', error.message);
  });

API Dokümantasyonu

new KatanaClient(options)

KatanaClient sınıfının bir örneğini oluşturur.

  • options (Object): Yapılandırma seçenekleri.
    • timeout (Number): İsteklerin zaman aşımı süresi (varsayılan: 5000 ms).
    • maxRedirects (Number): Maksimum yönlendirme sayısı (varsayılan: 5).
    • followRedirects (Boolean): Yönlendirme takibini etkinleştirir veya devre dışı bırakır (varsayılan: true).
    • defaultHeaders (Object): Varsayılan istek başlıkları.

client.get(requestUrl, headers)

GET isteği gönderir.

  • requestUrl (String): İstek yapılacak URL.
  • headers (Object): İstek başlıkları (opsiyonel).

Daha fazla metot için aynı formatta kullanılabilir: post, put, delete, head, options, patch, trace, connect.

client.cancelRequest(req)

Belirtilen isteği iptal eder.

  • req (http.ClientRequest): İptal edilecek istek nesnesi.

client.isRequestCancelled(req)

Belirtilen isteğin iptal edilip edilmediğini kontrol eder.

  • req (http.ClientRequest): Kontrol edilecek istek nesnesi.

Lisans

Bu modül MIT lisansı altında lisanslanmıştır. Detaylar için LICENSE dosyasına bakınız.

Keywords

FAQs

Package last updated on 16 Jun 2024

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc