Skip to content
Open
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
1 change: 0 additions & 1 deletion .coveralls.yml

This file was deleted.

22 changes: 22 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
name: build

on:
push:
branches: [master]
pull_request:

jobs:
test:
runs-on: ubuntu-latest
strategy:
matrix:
node: ['18', '20']
steps:
- uses: actions/checkout@v4
- name: Use Node ${{ matrix.node }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
cache: npm
- run: npm ci
- run: npm test
5 changes: 0 additions & 5 deletions .travis.yml

This file was deleted.

5 changes: 2 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
[![Build Status](https://travis-ci.org/crazysoftwarecoder/dagalti.svg?branch=master)](https://travis-ci.org/crazysoftwarecoder/dagalti)
[![Coverage Status](https://coveralls.io/repos/github/crazysoftwarecoder/dagalti/badge.svg?branch=master)](https://coveralls.io/github/crazysoftwarecoder/dagalti?branch=master)
[![build](https://github.com/crazysoftwarecoder/dagalti/actions/workflows/build.yml/badge.svg)](https://github.com/crazysoftwarecoder/dagalti/actions/workflows/build.yml)
![alt tag](https://raw.githubusercontent.com/crazysoftwarecoder/dagalti/master/images/Dagalti.png)

**Dagalti** is a dynamic proxy server that caches service responses. It is mainly used to reduce server startup time dramatically for developers who work on **codebases** that take too long to start locally due to the common problem of corporate headquarters <-> datacenter latency.
Expand All @@ -21,7 +20,7 @@ And of course Dagalti itself is open source with a [public repository]

### Installation

Dillinger requires [Node.js](https://nodejs.org/) v4+ to run.
Dagalti requires [Node.js](https://nodejs.org/) v18+ to run.

Please follow the below steps to install Dagalti:

Expand Down
9 changes: 7 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ var httpServer = http.createServer(function(request, response) {
var client = new Client();
var headers = request.headers;

var cacheKey = cache.getInstance().getKey(method, host, port, pathName, headers, body);
var value = cacheJSON[cacheKey];
var cacheKey;
var value;

var httpRequest = {
host: host,
Expand Down Expand Up @@ -76,6 +76,11 @@ var httpServer = http.createServer(function(request, response) {
httpRequest.body = body;
}

// Build the key once the body is in, otherwise POST requests with
// different bodies all collide on the same cache entry.
cacheKey = cache.getInstance().getKey(method, host, port, pathName, headers, body);
value = cacheJSON[cacheKey];

if (value) {
httpRequest.callback(value.status, value.statusMessage, value.headers, value.body);
}
Expand Down
Loading
Loading