Skip to content

Commit 668aa02

Browse files
authored
1.1 dev (#19)
* Add vagrant development environment * Fix typo * Fix #14 Delegate request content type to response * Update changelog * Fix #16 fix output buffer termination add shutdown event rename `Application::cleanUp` to `Application::collectGarbage` rename `Application::finishRequest` to `Application::shutdown` * Fix code style. Fluent setter update * Fix #17 Add logic for forcing response emitting * Fix #15 Enhance error handling logic * update content delegation * update loggers * log errors on runtime errors * fix typo * fix typo * Fix #3, #4, #5 * Update Application.php * Fix wrong response determined by content type delegation * remove unused tests
1 parent b4afec3 commit 668aa02

File tree

4 files changed

+25
-45
lines changed

4 files changed

+25
-45
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Blast Turbine Changelog
22

3+
## 1.1.7
4+
5+
### Altered
6+
7+
- Fix wrong response determined by content type delegation
8+
39
## 1.1.6
410

511
### Added

src/Application.php

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22
/**
3-
* Turbine Micro Framework. An advanced derivate of The Proton Micro Framework.
3+
* The Turbine Micro framework. An advanced Proton Micro Framework Derivate.
44
*
55
* @author Alex Bilbie <hello@alexbilbie.com>
66
* @author Marco Bunge <marco_bunge@web.de>
@@ -118,6 +118,12 @@ public function __construct($configuration = [])
118118
) {
119119
$this->setConfig($configuration);
120120
}
121+
$this->init();
122+
}
123+
124+
protected function init(){
125+
// configure request content type
126+
$this->setContentType(ServerRequestFactory::getHeader('content-type', ServerRequestFactory::fromGlobals()->getHeaders(), $this->getContentType()));
121127
}
122128

123129
/*******************************************
@@ -409,7 +415,7 @@ public function getResponse($content = '', $contentType = null)
409415
if (!$this->getContainer()->has(ResponseInterface::class)) {
410416
if ($this->isCli()) {
411417
$class = Response\TextResponse::class;
412-
} elseif ($this->isAjaxRequest()) {
418+
} elseif ($this->isJsonRequest()) {
413419
$class = Response\JsonResponse::class;
414420
} else {
415421
$class = Response\HtmlResponse::class;

tests/ApplicationTest.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<?php
2+
/**
3+
* The Turbine Micro Framework. An advanced derivate of Proton Micro Framework
4+
*
5+
* @author Marco Bunge <marco_bunge@web.de>
6+
* @author Alex Bilbie <hello@alexbilbie.com>
7+
* @copyright Marco Bunge <marco_bunge@web.de>
8+
*
9+
* @license MIT
10+
*/
211

312
namespace TurbineTests;
413

@@ -371,12 +380,13 @@ public function testContentTypeDelegation()
371380
return $response;
372381
});
373382

383+
$_SERVER['CONTENT_TYPE'] = 'application/json';
374384
$request = ServerRequestFactory::fromGlobals();
375-
$request = $request->withHeader('content-type', 'application/json');
376385

377386
$response = $app->handle($request);
378387

379388
$this->assertEquals($request->getHeader('content-type'), $response->getHeader('content-type'));
389+
$this->assertEquals(['application/json'], $response->getHeader('content-type'));
380390
}
381391

382392
public function testGetLoggers()

tests/RouteGroupTest.php

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)