@opra/core 0.31.6 → 0.31.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -597,8 +597,8 @@ class HttpAdapterHost extends platform_adapter_host_js_1.PlatformAdapterHost {
597
597
  const incoming = context.switchToHttp().incoming;
598
598
  const apiUrl = new common_1.OpraURL(incoming.baseUrl, incoming.protocol + '://' + incoming.get('host')).toString();
599
599
  const body = new common_1.OperationResult({
600
- context: endpoint.getFullPath(false),
601
- contextUrl: apiUrl + '/#' + endpoint.getFullPath(true)
600
+ context: '',
601
+ contextUrl: ''
602
602
  });
603
603
  const operationName = endpoint.kind === 'operation' ? endpoint.name : '';
604
604
  if (operationName === 'delete' || operationName === 'deleteMany' ||
@@ -628,9 +628,16 @@ class HttpAdapterHost extends platform_adapter_host_js_1.PlatformAdapterHost {
628
628
  }
629
629
  else
630
630
  body.typeUrl = body.contextUrl + '/type';
631
- body.payload = this.i18n.deep(response.value);
631
+ if (response.value instanceof common_1.OperationResult) {
632
+ Object.assign(body, response.value);
633
+ }
634
+ else
635
+ body.payload = response.value;
636
+ body.payload = this.i18n.deep(body.payload);
632
637
  }
633
638
  }
639
+ body.context = endpoint.getFullPath(false);
640
+ body.contextUrl = apiUrl + '/#' + endpoint.getFullPath(true);
634
641
  outgoing.setHeader(common_1.HttpHeaderCodes.Content_Type, 'application/opra+json; charset=utf-8');
635
642
  outgoing.send(JSON.stringify(body));
636
643
  outgoing.end();
@@ -593,8 +593,8 @@ export class HttpAdapterHost extends PlatformAdapterHost {
593
593
  const incoming = context.switchToHttp().incoming;
594
594
  const apiUrl = new OpraURL(incoming.baseUrl, incoming.protocol + '://' + incoming.get('host')).toString();
595
595
  const body = new OperationResult({
596
- context: endpoint.getFullPath(false),
597
- contextUrl: apiUrl + '/#' + endpoint.getFullPath(true)
596
+ context: '',
597
+ contextUrl: ''
598
598
  });
599
599
  const operationName = endpoint.kind === 'operation' ? endpoint.name : '';
600
600
  if (operationName === 'delete' || operationName === 'deleteMany' ||
@@ -624,9 +624,16 @@ export class HttpAdapterHost extends PlatformAdapterHost {
624
624
  }
625
625
  else
626
626
  body.typeUrl = body.contextUrl + '/type';
627
- body.payload = this.i18n.deep(response.value);
627
+ if (response.value instanceof OperationResult) {
628
+ Object.assign(body, response.value);
629
+ }
630
+ else
631
+ body.payload = response.value;
632
+ body.payload = this.i18n.deep(body.payload);
628
633
  }
629
634
  }
635
+ body.context = endpoint.getFullPath(false);
636
+ body.contextUrl = apiUrl + '/#' + endpoint.getFullPath(true);
630
637
  outgoing.setHeader(HttpHeaderCodes.Content_Type, 'application/opra+json; charset=utf-8');
631
638
  outgoing.send(JSON.stringify(body));
632
639
  outgoing.end();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opra/core",
3
- "version": "0.31.6",
3
+ "version": "0.31.7",
4
4
  "description": "Opra schema package",
5
5
  "author": "Panates",
6
6
  "license": "MIT",
@@ -29,7 +29,7 @@
29
29
  },
30
30
  "dependencies": {
31
31
  "@browsery/type-is": "^0.6.3",
32
- "@opra/common": "^0.31.6",
32
+ "@opra/common": "^0.31.7",
33
33
  "accepts": "^1.3.8",
34
34
  "content-disposition": "^0.5.4",
35
35
  "content-type": "^1.0.5",