mirror of
https://github.com/grpc/grpc-node.git
synced 2025-12-08 18:23:54 +00:00
change encoding type from MetadataValue to string
This commit is contained in:
parent
d68d94a5f4
commit
6d75ea1ab6
@ -33,7 +33,6 @@ import { StreamDecoder } from './stream-decoder';
|
||||
import { ObjectReadable, ObjectWritable } from './object-stream';
|
||||
import { ChannelOptions } from './channel-options';
|
||||
import * as logging from './logging';
|
||||
import { MetadataValue } from '.';
|
||||
|
||||
const TRACER_NAME = 'server_call';
|
||||
|
||||
@ -139,7 +138,7 @@ export class ServerReadableStreamImpl<RequestType, ResponseType>
|
||||
private call: Http2ServerCallStream<RequestType, ResponseType>,
|
||||
public metadata: Metadata,
|
||||
public deserialize: Deserialize<RequestType>,
|
||||
encoding?: MetadataValue
|
||||
encoding?: string
|
||||
) {
|
||||
super({ objectMode: true });
|
||||
this.cancelled = false;
|
||||
@ -254,7 +253,7 @@ export class ServerDuplexStreamImpl<RequestType, ResponseType>
|
||||
public metadata: Metadata,
|
||||
public serialize: Serialize<ResponseType>,
|
||||
public deserialize: Deserialize<RequestType>,
|
||||
encoding?: MetadataValue
|
||||
encoding?: string
|
||||
) {
|
||||
super({ objectMode: true });
|
||||
this.cancelled = false;
|
||||
@ -443,7 +442,7 @@ export class Http2ServerCallStream<
|
||||
return this.cancelled;
|
||||
}
|
||||
|
||||
private getDecompressedMessage(message: Buffer, encoding?: MetadataValue) {
|
||||
private getDecompressedMessage(message: Buffer, encoding?: string) {
|
||||
switch (encoding) {
|
||||
case 'deflate': {
|
||||
return new Promise<Buffer | undefined>((resolve, reject) => {
|
||||
@ -534,7 +533,7 @@ export class Http2ServerCallStream<
|
||||
return metadata;
|
||||
}
|
||||
|
||||
receiveUnaryMessage(encoding?: MetadataValue): Promise<RequestType> {
|
||||
receiveUnaryMessage(encoding?: string): Promise<RequestType> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const stream = this.stream;
|
||||
const chunks: Buffer[] = [];
|
||||
@ -730,7 +729,7 @@ export class Http2ServerCallStream<
|
||||
readable:
|
||||
| ServerReadableStream<RequestType, ResponseType>
|
||||
| ServerDuplexStream<RequestType, ResponseType>,
|
||||
encoding?: MetadataValue
|
||||
encoding?: string
|
||||
) {
|
||||
const decoder = new StreamDecoder();
|
||||
|
||||
|
||||
@ -61,7 +61,6 @@ import {
|
||||
import { parseUri } from './uri-parser';
|
||||
import { ChannelzCallTracker, ChannelzChildrenTracker, ChannelzTrace, registerChannelzServer, registerChannelzSocket, ServerInfo, ServerRef, SocketInfo, SocketRef, TlsInfo, unregisterChannelzRef } from './channelz';
|
||||
import { CipherNameAndProtocol, TLSSocket } from 'tls';
|
||||
import { MetadataValue } from '.';
|
||||
|
||||
const TRACER_NAME = 'server';
|
||||
|
||||
@ -779,7 +778,7 @@ export class Server {
|
||||
});
|
||||
}
|
||||
const metadata = call.receiveMetadata(headers);
|
||||
const encoding: MetadataValue | undefined = metadata.get('grpc-encoding')[0];
|
||||
const encoding = metadata.get('grpc-encoding')[0] as string | undefined;
|
||||
metadata.remove('grpc-encoding');
|
||||
|
||||
switch (handler.type) {
|
||||
@ -864,7 +863,7 @@ async function handleUnary<RequestType, ResponseType>(
|
||||
call: Http2ServerCallStream<RequestType, ResponseType>,
|
||||
handler: UnaryHandler<RequestType, ResponseType>,
|
||||
metadata: Metadata,
|
||||
encoding?: MetadataValue
|
||||
encoding?: string
|
||||
): Promise<void> {
|
||||
const request = await call.receiveUnaryMessage(encoding);
|
||||
|
||||
@ -895,7 +894,7 @@ function handleClientStreaming<RequestType, ResponseType>(
|
||||
call: Http2ServerCallStream<RequestType, ResponseType>,
|
||||
handler: ClientStreamingHandler<RequestType, ResponseType>,
|
||||
metadata: Metadata,
|
||||
encoding?: MetadataValue
|
||||
encoding?: string
|
||||
): void {
|
||||
const stream = new ServerReadableStreamImpl<RequestType, ResponseType>(
|
||||
call,
|
||||
@ -926,7 +925,7 @@ async function handleServerStreaming<RequestType, ResponseType>(
|
||||
call: Http2ServerCallStream<RequestType, ResponseType>,
|
||||
handler: ServerStreamingHandler<RequestType, ResponseType>,
|
||||
metadata: Metadata,
|
||||
encoding?: MetadataValue
|
||||
encoding?: string
|
||||
): Promise<void> {
|
||||
const request = await call.receiveUnaryMessage(encoding);
|
||||
|
||||
@ -948,7 +947,7 @@ function handleBidiStreaming<RequestType, ResponseType>(
|
||||
call: Http2ServerCallStream<RequestType, ResponseType>,
|
||||
handler: BidiStreamingHandler<RequestType, ResponseType>,
|
||||
metadata: Metadata,
|
||||
encoding?: MetadataValue
|
||||
encoding?: string
|
||||
): void {
|
||||
const stream = new ServerDuplexStreamImpl<RequestType, ResponseType>(
|
||||
call,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user